Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/nicoelayda/scrollviewminimap
- Owner: nicoelayda
- License: mit
- Created: 2020-12-06T22:56:07.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-13T06:13:17.000Z (almost 4 years ago)
- Last Synced: 2024-09-16T08:24:03.683Z (about 2 months ago)
- Topics: ios, minimap, minimap-control, swift, swiftui, uiscrollview, xcode
- Language: Swift
- Homepage:
- Size: 3.33 MB
- Stars: 24
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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).