MapView
public class MapView : MKMapView
extension MapView: LocationHelperDelegate
extension MapView: MKMapViewDelegate
A customized MapView with additional actions.
Version
1.4.0Date
23/08/2018-
The default zoom level while showing user’s location.
Declaration
Swift
public static let defaultUserLocationMargin: Double -
The delegate of the map.
Declaration
Swift
public weak var mapViewDelegate: MapViewDelegate? -
Set the view of the map.
Declaration
Swift
public func setViewport(withCenterLatitude latitude: Double, andCenterLongitude longitude: Double, withZoomLevel zoomLevel: Double? = nil, withAnimation shouldAnimate: Bool = true)Parameters
latitudeThe center latitude of the view.
longitudeThe center longitude of the view.
zoomLevelThe zoom level. If it is nil, zoom level will not be changed.
shouldAnimateWhether the animation should be allowed or not.
-
Set the view of the map.
Declaration
Swift
public func setViewport(withTopLatitude topLatitude: Double, bottomLatitude: Double, leftLongitude: Double, andRightLongitude rightLongitude: Double, withAnimation shouldAnimate: Bool = true)Parameters
topLatitudeThe top latitude.
bottomLatitudeThe bottom latitude.
leftLongitudeThe left longitude.
rightLongitudeThe right longitude.
shouldAnimateWhether the animation should be performed or not.
-
Adjust the viewport according to the points and lines within it.
Declaration
Swift
public func overview() -
Add a point on the map.
Declaration
Swift
public func add(_ point: MapViewPoint)Parameters
pointThe point.
-
Add a line onto the map.
Declaration
Swift
public func add(_ line: MapViewLine)Parameters
lineThe line to be presented.
-
Request user authorization on always use location.
Declaration
Swift
public func requestUserLocation() -
Show current location.
Declaration
Swift
public func showUserLocation(withZoomLevel zoomLevel: Double = defaultUserLocationMargin)Parameters
zoomLevelThe zoom level while showing user’s location.
-
Clean all the points and lines on the map.
Declaration
Swift
public func reset() -
Undocumented
Declaration
Swift
public required init?(coder aDecoder: NSCoder) -
Undocumented
Declaration
Swift
public override init(frame: CGRect) -
Undocumented
Declaration
Swift
override public func prepareForInterfaceBuilder() -
Declaration
Swift
public func locationHelper(_ locationHelper: LocationHelper, didCatchError error: String) -
Declaration
Swift
public func locationHelper(_ locationHelper: LocationHelper, didAuthorizeAlwaysAuthorization isAuthorized: Bool) -
Declaration
Swift
public func locationHelper(_ locationHelper: LocationHelper, didAuthorizeWhenInUseAuthorization isAuthorized: Bool) -
Undocumented
Declaration
Swift
public func mapView(_ mapView: MKMapView, didUpdate userLocation: MKUserLocation) -
Undocumented
Declaration
Swift
public func mapView(_ mapView: MKMapView, regionDidChangeAnimated animated: Bool) -
Undocumented
Declaration
Swift
public func mapView(_ mapView: MKMapView, regionWillChangeAnimated animated: Bool) -
Undocumented
Declaration
Swift
public func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? -
Undocumented
Declaration
Swift
public func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer
MapView Class Reference