MapView

public class MapView : MKMapView
extension MapView: LocationHelperDelegate
extension MapView: MKMapViewDelegate

A customized MapView with additional actions.

Author

Adamas

Version

1.4.0

Date

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

    latitude

    The center latitude of the view.

    longitude

    The center longitude of the view.

    zoomLevel

    The zoom level. If it is nil, zoom level will not be changed.

    shouldAnimate

    Whether 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

    topLatitude

    The top latitude.

    bottomLatitude

    The bottom latitude.

    leftLongitude

    The left longitude.

    rightLongitude

    The right longitude.

    shouldAnimate

    Whether 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

    point

    The point.

  • Add a line onto the map.

    Declaration

    Swift

    public func add(_ line: MapViewLine)

    Parameters

    line

    The 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

    zoomLevel

    The 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