VMMapViewDelegate

@objc
public protocol VMMapViewDelegate : NSObjectProtocol

Protocol for receiving VMMapView callbacks

Since

1.1

Optional Methods

  • Called when the map view has finished loading

    Since

    1.2.1

    Declaration

    Swift

    @objc
    optional func didFinishLoadingMapView(_ mapView: VMMapView)

    Parameters

    mapView

    the mapView

  • Called when the mapview fails to load

    Since

    1.2.1

    Declaration

    Swift

    @objc
    optional func didFailToLoadMapView(error: Error)

    Parameters

    error

    the error that caused the failure

  • Called to see if its possible to select a unit

    Declaration

    Swift

    @objc
    optional func canSelectUnit(_ unit: VMMSMapUnit) -> Bool

    Parameters

    unit

    the unit to select

    Return Value

    true to allow selection, false otherwise

  • Called after a new unit has been selected

    Declaration

    Swift

    @objc
    optional func didSelectUnit(_ unit: VMMSMapUnit?)

    Parameters

    unit

    the unit that is selected

  • Called when user taps on a point in the map.

    Since

    2.0

    Declaration

    Swift

    @objc
    optional func didTapAtLocationCoordinate(_ location: CLLocationCoordinate2D)

    Parameters

    location

    the location of the tap

  • Called to verify that it’s OK to update the camera position. You might use this method to restrict camera movement.

    Since

    1.2

    Declaration

    Swift

    @objc
    optional func shouldChangeCameraPosition(toLocation newLocation: CLLocationCoordinate2D, toBearing newBearing: Double, toTilt newTilt: Double) -> Bool

    Parameters

    newLocation

    the newLocation

    newBearing

    the new bearing

    newTilt

    the new tilt

    Return Value

    true to proceed with changeing the camera

  • Called when the map position changes

    Declaration

    Swift

    @objc
    optional func didChangeCameraPosition(toLocation newLocation: CLLocationCoordinate2D, toZoom newZoom: Float, toBearing newBearing: Double, toTilt newTilt: Double)

    Parameters

    newLocation

    the new map location

    newZoom

    the new map zoom

    newBearing

    the new map bearing

    newTilt

    the new map tilt

  • Called to get stroke color for a polyline, should NOT have transparency

    Declaration

    Swift

    @objc
    optional func strokeColorForPolyline(_ line: VMPolyline) -> UIColor?

    Parameters

    line

    the line

    Return Value

    the color of the line, or nil to use defaults

  • Called to get the line width for a polyline

    Declaration

    Swift

    @objc
    optional func lineWidthForPolyline(_ line: VMPolyline) -> Float

    Parameters

    line

    the line

    Return Value

    the width

  • Called to get transparency value for a polyline

    Declaration

    Swift

    @objc
    optional func alphaForPolyline(_ line: VMPolyline) -> Float

    Parameters

    line

    the line

    Return Value

    the transparency value (0 for invisible, 1.0 to fully opaque)

  • Called to provide a custom view for a point annotation

    Declaration

    Swift

    @objc
    optional func viewForPointAnnotation(_ annotation: VMPointAnnotation) -> UIView?

    Parameters

    annotation

    the annotation

    Return Value

    the custom view

  • Called to provide a custom image for a point annotation

    Declaration

    Swift

    @objc
    optional func imageForPointAnnotation(_ annotation: VMPointAnnotation) -> UIImage?

    Parameters

    annotation

    the annotation

    Return Value

    the custom image

  • Called when a map annotation is selected

    Since

    1.2

    Declaration

    Swift

    @objc
    optional func didSelectAnnotation(_ annotation: VMMapAnnotation)

    Parameters

    annotation

    the annotation

  • Called to provide a custom view for a annotation callout

    Since

    1.4

    Declaration

    Swift

    @objc
    optional func calloutViewForPointAnnotation(_ annotation: VMPointAnnotation) -> VMAnnotationCalloutView?

    Parameters

    annotation

    the annotation

    Return Value

    the custom view

  • Determine if a callout should be shown for a particular annotation

    Since

    1.4

    Declaration

    Swift

    @objc
    optional func canShowCalloutViewForPointAnnotation(_ annotation: VMPointAnnotation) -> Bool

    Parameters

    annotation

    the annotation

    Return Value

    true if the callout should show