ZoomableMapInteraction is a UIInteraction
which can be used to add the tap-and-pan zooming behavior seen in Apple Maps to any MKMapView
.
To add the interaction to a mapView
you write:
mapView.addInteraction(ZoomableMapInteraction())
You can check the example project which includes only a plain MKMapView
with the interaction added. Open the example project using
pod try ZoomableMapInteraction
Because this project implements a UIInteraction
it requires iOS 11. It depends only on UIKit and MapKit.
There's only one file, ZoomableMapInteraction.swift
, which you can either add to your project directly or you can use cocoapods.
To use cocoapods:
pod 'ZoomableMapInteraction'
Sven Titgemeyer, [email protected]
ZoomableMapInteraction is available under the MIT license. See the LICENSE file for more info.