Protocols
The following protocols are available globally.
-
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 ofTomTomSDKRoute.Routeusing theNavigationVisualization.displayRoutePlan(_:)method. After that, theTomTomSDKRoute.Routecontained in the collection is displayed on the map, and you can useNavigationVisualization.setActiveRoute(_:)to select a route on which to navigate. You can access the collection of route primitives displayed on the map usingroutesproperty. The active route and the alternative routes are styled with the properties contained in theStyleConfigurationprovided toNavigationVisualizationFactory.create(map:navigation:styleConfiguration:). Next, select the type of navigation guidance withNavigationVisualization.selectGuidanceType(_:), and start the navigation session withNavigation.start(). Once the navigation session is started, the route that is selected becomes the active route. When you’re done using a NavigationVisualization instance, callNavigation.stop(). Then callNavigationVisualization.clear()to remove all the primitives that have been added to the map by the add-on.If a
TomTomSDKRoute.Routehas traffic data available, traffic incidents are displayed on the map on top of theTomTomSDKRoute.Route. You can access the list of traffic incident lines that are on a route usingNavigationVisualization.trafficOnRoutes(_:)property by UUID of correspondingTomTomSDKMapDisplay.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.
See moreImportant
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
public protocol NavigationVisualization : AnyObject
Protocols Reference