MapViewDelegate

public protocol MapViewDelegate : AnyObject

The MapViewDelegate protocol defines a set of methods that can be implemented to receive events and updates related to the MapView life cycle.

  • Tells the delegate that the map view is ready to use.

    The map parameter is an instance of TomTomMap that implements: CameraActions, AnnotationsActions, RouteActions, LocationActions, MapActions.

    Declaration

    Swift

    func mapView(_ mapView: MapView, onMapReady map: TomTomMap)

    Parameters

    mapView

    The map view informing the delegate of its readiness.

    map

    The TomTomMap object, the entry point for map manipulation, such as adding a marker, manipulating the camera position, etc.

  • Tells the delegate that a certain map style was loaded, either successfully with the respective StyleContaineror unsuccessfully with an Error.

    If the MapView has a previously cached style, it will be loaded. If an error is caused by a network connection issues, fetching the style will be retried after the network connection is restored.

    Declaration

    Swift

    func mapView(_ mapView: MapView, onStyleLoad result: Result<StyleContainer, Error>)

    Parameters

    mapView

    The map view informing the delegate of its readiness.

    result

    Contains the StyleContainer when the style was successfully loaded or an Error where the style loading operation encounters failure. A failure to load a style can be caused by an invalid API key, invalid style, network connection issues and more issues that will be indicated in the Error‘s description.