Skip to content

Latest commit

 

History

History
331 lines (219 loc) · 6.92 KB

Map.md

File metadata and controls

331 lines (219 loc) · 6.92 KB

Map

public class Map: MKMapView

Inheritance

MKMapView, MKMapViewDelegate

Initializers

init(lat:lon:points:)

public init(lat latitude: Double, lon longitude: Double, points: (() -> [MapPoint])? = nil)

init(region:points:)

convenience init(region: MKCoordinateRegion, points: (() -> [MapPoint])? = nil)

Methods

type(_:)

@discardableResult func type(_ type: MKMapType) -> Self

zoomEnabled(_:)

@discardableResult func zoomEnabled(_ value: Bool = true) -> Self

scrollEnabled(_:)

@discardableResult func scrollEnabled(_ value: Bool = true) -> Self

pitchEnabled(_:)

@discardableResult func pitchEnabled(_ value: Bool = true) -> Self

rotateEnabled(_:)

@discardableResult func rotateEnabled(_ value: Bool = true) -> Self

delegate(_:)

Note:​ If delegate isn't its own class, modifiers based on delegate's methods will do nothing.

@discardableResult func delegate(_ delegate: MKMapViewDelegate?) -> Self

zoom(_:)

@discardableResult func zoom(_ multiplier: Double) -> Self

visible(rect:animate:edgePadding:)

@discardableResult func visible(rect: MKMapRect, animate: Bool = true, edgePadding: UIEdgeInsets? = nil) -> Self

move(to:animate:)

Changes coordinates and span.

@discardableResult func move(to region: MKCoordinateRegion, animate: Bool = true) -> Self

move(to:animate:)

Changes only coordinates.

@discardableResult func move(to coordinates: CLLocationCoordinate2D, animate: Bool = true) -> Self

center(_:animated:)

@discardableResult func center(_ center: CLLocationCoordinate2D, animated: Bool = true) -> Self

show(annotations:animated:)

@discardableResult func show(annotations: [MKAnnotation], animated: Bool = true) -> Self

show(annotations:animated:)

@discardableResult func show(annotations: MKAnnotation, animated: Bool = true) -> Self

camera(boundary:animated:)

@discardableResult func camera(boundary: MKMapView.CameraBoundary?, animated: Bool = true) -> Self

set(cameraZoomRange:animated:)

@discardableResult func set(cameraZoomRange: MKMapView.CameraZoomRange?, animated: Bool) -> Self

camera(_:animated:)

@discardableResult func camera(_ camera: MKMapCamera, animated: Bool = true) -> Self

showBuildings(_:)

@discardableResult func showBuildings(_ bool: Bool) -> Self

showCompass(_:)

@discardableResult func showCompass(_ bool: Bool) -> Self

showScale(_:)

@discardableResult func showScale(_ bool: Bool) -> Self

showTraffic(_:)

@discardableResult func showTraffic(_ bool: Bool) -> Self

pointOfInterestFilter(filter:)

@discardableResult func pointOfInterestFilter(filter: MKPointOfInterestFilter?) -> Self

showUserLocation(_:)

@discardableResult func showUserLocation(_ bool: Bool) -> Self

user(trackingMode:animated:)

@discardableResult func user(trackingMode: MKUserTrackingMode, animated: Bool = true) -> Self

select(annotation:animated:)

@discardableResult func select(annotation: MKAnnotation, animated: Bool = true) -> Self

deselect(annotation:animated:)

@discardableResult func deselect(annotation: MKAnnotation, animated: Bool = true) -> Self

remove(annotation:)

@discardableResult func remove(annotation: MKAnnotation) -> Self

remove(annotations:)

@discardableResult func remove(annotations: [MKAnnotation]) -> Self

add(annotation:)

@discardableResult func add(annotation: MKAnnotation) -> Self

add(point:)

@discardableResult func add(point: MapPoint) -> Self

add(annotations:)

@discardableResult func add(annotations: [MKAnnotation]) -> Self

add(points:)

@discardableResult func add(points: [MapPoint]) -> Self

register(classes:)

@discardableResult func register(classes: [String: AnyClass.Type]) -> Self

fitTo(region:)

@discardableResult func fitTo(region: MKCoordinateRegion) -> Self

fitTo(rect:edgePadding:)

@discardableResult func fitTo(rect: MKMapRect, edgePadding: UIEdgeInsets? = nil) -> Self

onFinishLoading(_:)

@discardableResult func onFinishLoading(_ handler: @escaping (MKMapView) -> ()) -> Self

afterRegionChange(_:)

@discardableResult func afterRegionChange(_ handler: @escaping (MKMapView) -> ()) -> Self

beforeRegionChange(_:)

@discardableResult func beforeRegionChange(_ handler: @escaping (MKMapView) -> ()) -> Self

configure(identifier:_:)

@discardableResult func configure(identifier: String?, _ annotationView: @escaping ((MKAnnotationView?, MKAnnotation) -> (MKAnnotationView?))) -> Self

onAccessoryTap(_:)

@discardableResult func onAccessoryTap(_ handler: @escaping (MKMapView, MKAnnotationView, UIControl) -> ()) -> Self

onAnnotationViewStateChange(_:)

@discardableResult func onAnnotationViewStateChange(_ handler: @escaping ((MKMapView, MKAnnotationView, MKAnnotationView.DragState, MKAnnotationView.DragState) -> ())) -> Self

onAnnotationSelect(_:)

@discardableResult func onAnnotationSelect(_ handler: @escaping ((MKMapView, MKAnnotationView) -> ())) -> Self

onAnnotationDeselect(_:)

@discardableResult func onAnnotationDeselect(_ handler: @escaping ((MKMapView, MKAnnotationView) -> ())) -> Self

mapViewDidFinishLoadingMap(_:)

public func mapViewDidFinishLoadingMap(_ mapView: MKMapView)

mapView(_:regionDidChangeAnimated:)

public func mapView(_ mapView: MKMapView, regionDidChangeAnimated animated: Bool)

mapView(_:regionWillChangeAnimated:)

public func mapView(_ mapView: MKMapView, regionWillChangeAnimated animated: Bool)

mapView(_:viewFor:)

public func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView?

mapView(_:annotationView:calloutAccessoryControlTapped:)

public func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl)

mapView(_:annotationView:didChange:fromOldState:)

public func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, didChange newState: MKAnnotationView.DragState, fromOldState oldState: MKAnnotationView.DragState)

mapView(_:didSelect:)

public func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView)

mapView(_:didDeselect:)

public func mapView(_ mapView: MKMapView, didDeselect view: MKAnnotationView)