NavigationMapViewDelegate

public protocol NavigationMapViewDelegate : AnyObject, UnimplementedLogging

The NavigationMapViewDelegate provides methods for configuring the NavigationMapView, as well as responding to events triggered by the NavigationMapView.

  • Asks the receiver to return a LineLayer for the route line, given a layer identifier and a source identifier. This method is invoked when the map view loads and any time routes are added.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func navigationMapView(_ navigationMapView: NavigationMapView, routeLineLayerWithIdentifier identifier: String, sourceIdentifier: String) -> LineLayer?

    Parameters

    navigationMapView

    The NavigationMapView object.

    identifier

    The LineLayer identifier.

    sourceIdentifier

    Identifier of the source, which contains the route data that this method would style.

    Return Value

    A LineLayer that is applied to the route line.

  • Asks the receiver to return a LineLayer for the casing layer that surrounds route line, given a layer identifier and a source identifier. This method is invoked when the map view loads and any time routes are added.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func navigationMapView(_ navigationMapView: NavigationMapView, routeCasingLineLayerWithIdentifier identifier: String, sourceIdentifier: String) -> LineLayer?

    Parameters

    navigationMapView

    The NavigationMapView object.

    identifier

    The LineLayer identifier.

    sourceIdentifier

    Identifier of the source, which contains the route data that this method would style.

    Return Value

    A LineLayer that is applied as a casing around the route line.

  • Asks the receiver to return a LineLayer for highlighting restricted areas portions of the route, given a layer identifier and a source identifier. This method is invoked when showsRestrictedAreasOnRoute is enabled, the map view loads and any time routes are added.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func navigationMapView(_ navigationMapView: NavigationMapView, routeRestrictedAreasLineLayerWithIdentifier identifier: String, sourceIdentifier: String) -> LineLayer?

    Parameters

    navigationMapView

    The NavigationMapView object.

    identifier

    The LineLayer identifier.

    sourceIdentifier

    Identifier of the source, which contains the route data that this method would style.

    Return Value

    A LineLayer that is applied as restricted areas on the route line.

  • navigationMapView(_:willAdd:) Default implementation

    Asks the receiver to adjust the default layer which will be added to the map view and return a Layer. This method is invoked when the map view loads and any time a layer will be added.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func navigationMapView(_ navigationMapView: NavigationMapView, willAdd layer: Layer) -> Layer?

    Parameters

    navigationMapView

    The NavigationMapView object.

    layer

    A default Layer generated by the navigationMapView.

    Return Value

    A Layer after adjusted and will be added to the map view by MapboxNavigation.

  • navigationMapView(_:shapeFor:) Default implementation

    Asks the receiver to return an LineString that describes the geometry of the route. Resulting LineString will then be styled using NavigationMapView.navigationMapView(_:routeLineLayerWithIdentifier:sourceIdentifier:) provided style or a default congestion style if above delegate method was not implemented.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func navigationMapView(_ navigationMapView: NavigationMapView, shapeFor route: Route) -> LineString?

    Parameters

    navigationMapView
    route

    The route that the sender is asking about.

    Return Value

    A LineString object that defines the shape of the route, or nil in case of default behavior.

  • navigationMapView(_:casingShapeFor:) Default implementation

    Asks the receiver to return an LineString that describes the geometry of the route casing. Resulting LineString will then be styled using NavigationMapView.navigationMapView(_:routeCasingLineLayerWithIdentifier:sourceIdentifier:) provided style or a default style if above delegate method was not implemented.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func navigationMapView(_ navigationMapView: NavigationMapView, casingShapeFor route: Route) -> LineString?

    Parameters

    navigationMapView
    route

    The route that the sender is asking about.

    Return Value

    A LineString object that defines the shape of the route casing, or nil in case of default behavior.

  • Asks the receiver to return an LineString that describes the geometry of the route restricted areas. Resulting LineString will then be styled using NavigationMapView.navigationMapView(_:routeRestrictedAreasLineLayerWithIdentifier:sourceIdentifier:) provided style or a default style if above delegate method was not implemented.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func navigationMapView(_ navigationMapView: NavigationMapView, restrictedAreasShapeFor route: Route) -> LineString?

    Parameters

    navigationMapView
    route

    The route that the sender is asking about.

    Return Value

    A LineString object that defines the shape of the route restricted areas, or nil in case of default behavior.

  • Asks the receiver to return a CircleLayer for waypoints, given an identifier and source. This method is invoked any time waypoints are added or shown.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func navigationMapView(_ navigationMapView: NavigationMapView, waypointCircleLayerWithIdentifier identifier: String, sourceIdentifier: String) -> CircleLayer?

    Parameters

    navigationMapView

    The NavigationMapView object.

    identifier

    The CircleLayer identifier.

    sourceIdentifier

    Identifier of the source, which contains the waypoint data that this method would style.

    Return Value

    A CircleLayer that the map applies to all waypoints.

  • Asks the receiver to return a SymbolLayer for waypoint symbols, given an identifier and source. This method is invoked any time waypoints are added or shown.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func navigationMapView(_ navigationMapView: NavigationMapView, waypointSymbolLayerWithIdentifier identifier: String, sourceIdentifier: String) -> SymbolLayer?

    Parameters

    navigationMapView

    The NavigationMapView object.

    identifier

    The SymbolLayer identifier.

    sourceIdentifier

    Identifier of the source, which contains the waypoint data that this method would style.

    Return Value

    A SymbolLayer that the map applies to all waypoint symbols.

  • Asks the receiver to return a FeatureCollection that describes the geometry of the waypoint.

    Default Implementation

    UnimplementedLogging prints a warning to standard output the first time this method is called.

    Declaration

    Swift

    func navigationMapView(_ navigationMapView: NavigationMapView, shapeFor waypoints: [Waypoint], legIndex: Int) -> FeatureCollection?

    Parameters

    navigationMapView
    waypoints

    The waypoints to be displayed on the map.

    legIndex

    Index, which determines for which RouteLeg Waypoint will be shown.

    Return Value

    Optionally, a FeatureCollection that defines the shape of the waypoint, or nil to use default behavior.