Skip to content

Custom control for adding minimap functionality to UIScrollView.

License

Notifications You must be signed in to change notification settings

nicoelayda/ScrollViewMinimap

Folders and files

NameName
Last commit message
Last commit date
Dec 13, 2020
Dec 13, 2020
Dec 13, 2020
Dec 6, 2020
Dec 13, 2020
Dec 13, 2020
Dec 13, 2020

Repository files navigation

ScrollViewMinimap

ScrollViewMinimap is a control for adding minimap functionality to UIScrollView.

ScrollViewMinimap_Preview

Features

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

Installation

Cocoapods

Add ScrollViewMinimap to your Podfile.

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.

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

Manual

Copy the contents of 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.

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

    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.

License

MIT. See LICENSE.

Credits

Sample Photo from Unsplash.