Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nicoelayda/scrollviewminimap

Custom control for adding minimap functionality to UIScrollView.
https://github.com/nicoelayda/scrollviewminimap

ios minimap minimap-control swift swiftui uiscrollview xcode

Last synced: 26 days ago
JSON representation

Custom control for adding minimap functionality to UIScrollView.

Awesome Lists containing this project

README

        

# ScrollViewMinimap

ScrollViewMinimap is a control for adding minimap functionality to `UIScrollView`.

![ScrollViewMinimap_Preview](https://user-images.githubusercontent.com/4868132/101295673-0f4f4f00-385a-11eb-9fa2-8a92baf772d2.gif)

## Features

- Automatic sizing based on scroll view's content view.
- Automatic thumbnail generation.
- Customisable highlight rect.

## Installation

### Cocoapods

Add `ScrollViewMinimap` to your `Podfile`.

```ruby
pod 'ScrollViewMinimap', '~> 1.0.0'
```

### Swift Package Manager

In Xcode, select **File > Swift Packages > Add Package Dependency...**

Add `https://github.com/nicoelayda/ScrollViewMinimap.git` as the package repository URL.

**or**

If you have an existing `Package.swift` file, add `ScrollViewMinimap` package to your target's dependencies.

```swift
dependencies: [
.package(url: "https://github.com/nicoelayda/ScrollViewMinimap.git", .upToNextMajor(from: "1.0.0"))
]
```

### Manual

Copy the contents of [`Sources/ScrollViewMinimap`](https://github.com/nicoelayda/ScrollViewMinimap/tree/master/Sources/ScrollViewMinimap) to your project.

## Usage
1. Add `ScrollViewMinimap` to your `UIScrollView`'s view controller.
2. In `viewDidLoad()`, set the `scrollView` property to your scroll view.

```swift
minimap.scrollView = scrollView
```

3. In your `UIScrollViewDelegate`, call `update(animated:)` in `scrollViewDidScroll(_:)` and `scrollViewDidZoom(_:)` .

```swift
func scrollViewDidScroll(_ scrollView: UIScrollView) {
minimap.update(animated: true)
}

func scrollViewDidZoom(_ scrollView: UIScrollView) {
minimap.update(animated: true)
}
```

Check out [**ScrollViewMinimap-Examples**](https://github.com/nicoelayda/ScrollViewMinimap-Examples) for sample projects using ScrollViewMinimap.

## License

MIT. See [LICENSE](https://github.com/nicoelayda/ScrollViewMinimap/blob/master/LICENSE).

## Credits

Sample Photo from [Unsplash](https://unsplash.com/photos/KwT8fAZq6fI).