Protocols

The following protocols are available globally.

NavigationVisualization

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

    To start using the navigation visualization, create an instance using NavigationVisualizationFactory.create(map:navigation:styleConfiguration:). Then provide the instance with a collection of TomTomSDKRoute.Route using the NavigationVisualization.displayRoutePlan(_:) method. After that, the TomTomSDKRoute.Route contained in the collection is displayed on the map, and you can use NavigationVisualization.setActiveRoute(_:) to select a route on which to navigate. You can access the collection of route primitives displayed on the map using routes property. The active route and the alternative routes are styled with the properties contained in the StyleConfiguration provided to NavigationVisualizationFactory.create(map:navigation:styleConfiguration:). Next, select the type of navigation guidance with NavigationVisualization.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 NavigationVisualization instance, call Navigation.stop(). Then call NavigationVisualization.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 NavigationVisualization.trafficOnRoutes(_:) property by UUID of corresponding TomTomSDKMapDisplay.Route.

    The navigation visualization add-on observes certain events during its lifecycle 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 NavigationVisualization : AnyObject