Protocols

The following protocols are available globally.

NavigationVisualizationServiceBuilderProtocol

  • A builder to build navigation visualisation service.

    Important

    This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public protocol NavigationVisualizationServiceBuilderProtocol

NavigationVisualizationServiceProtocol

  • Entry point for all methods related to the navigation visualization addon.

    To start using the Navigation Visualization addon, create an instance using NavigationVisualizationServiceBuilder.build(map:navigation:styleConfiguration:). Then provide the instance with a collection of TomTomSDKRoute.Route using the NavigationVisualizationServiceProtocol.displayRoutes(routes:) method. After that, the TomTomSDKRoute.Route contained in the collection is displayed on the map, and you can use NavigationVisualizationServiceProtocol.selectRoute(_:) to select a route on which to navigate. You can access the collection of route primitives displayed on the map using routes property. The selected route and the alternative routes are styled with the properties contained in the StyleConfiguration provided to NavigationVisualizationServiceBuilder.build(map:navigation:styleConfiguration:). Next, select the type of navigation guidance with NavigationVisualizationServiceProtocol.selectGuidanceType(_:), and start the navigation session with Navigation.start(). Once the navigation session is started, the route that is selected becomes the active route. When you’re done using a NavigationVisualizationServiceProtocol instance, call Navigation.stop(). Then call NavigationVisualizationServiceProtocol.clear() to remove all the primitives that have been added to the map by the add-on.

    If a TomTomSDKRoute.Route has traffic data available, traffic incidents are displayed on the map on top of the TomTomSDKRoute.Route. You can access the list of traffic incident lines that are on a route using NavigationVisualizationServiceProtocol.trafficOnRoutes property by UUID of corresponding TomTomSDKMapDisplay.Route.

    The navigation visualization add-on observes certain events during its life cycle, so that it can react automatically to important events:

    • NavigationArrivalObserver.didStart(with:): The add-on observes when a navigation session starts.
    • NavigationRouteObserver.didReplanRoute(replannedRoute:reason:) : The add-on observes when the current route is updated.
    • NavigationProgressObserver.didUpdateProgress(progress:): The add-on observes when progress is updated on the current route.
    • NavigationArrivalObserver.didArriveAtDestinationOn(route:): The add-on observes when the driver reaches the destination.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    See more

    Declaration

    Swift

    public protocol NavigationVisualizationServiceProtocol : AnyObject