ScrollViewMinimap is a control for adding minimap functionality to UIScrollView
.
- Automatic sizing based on scroll view's content view.
- Automatic thumbnail generation.
- Customisable highlight rect.
Add ScrollViewMinimap
to your Podfile
.
pod 'ScrollViewMinimap', '~> 1.0.0'
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.
dependencies: [
.package(url: "https://github.com/nicoelayda/ScrollViewMinimap.git", .upToNextMajor(from: "1.0.0"))
]
Copy the contents of Sources/ScrollViewMinimap
to your project.
-
Add
ScrollViewMinimap
to yourUIScrollView
's view controller. -
In
viewDidLoad()
, set thescrollView
property to your scroll view.minimap.scrollView = scrollView
-
In your
UIScrollViewDelegate
, callupdate(animated:)
inscrollViewDidScroll(_:)
andscrollViewDidZoom(_:)
.func scrollViewDidScroll(_ scrollView: UIScrollView) { minimap.update(animated: true) } func scrollViewDidZoom(_ scrollView: UIScrollView) { minimap.update(animated: true) }
Check out ScrollViewMinimap-Examples for sample projects using ScrollViewMinimap.
MIT. See LICENSE.
Sample Photo from Unsplash.