Protocols
The following protocols are available globally.
-
A builder to build navigation visualisation service.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol NavigationVisualizationServiceBuilderProtocol
-
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 ofTomTomSDKRoute.Route
using theNavigationVisualizationServiceProtocol.displayRoutes(routes:)
method. After that, theTomTomSDKRoute.Route
contained in the collection is displayed on the map, and you can useNavigationVisualizationServiceProtocol.selectRoute(_:)
to select a route on which to navigate. You can access the collection of route primitives displayed on the map usingroutes
property. The selected route and the alternative routes are styled with the properties contained in theStyleConfiguration
provided toNavigationVisualizationServiceBuilder.build(map:navigation:styleConfiguration:)
. Next, select the type of navigation guidance withNavigationVisualizationServiceProtocol.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 NavigationVisualizationServiceProtocol instance, callNavigation.stop()
. Then callNavigationVisualizationServiceProtocol.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 theTomTomSDKRoute.Route
. You can access the list of traffic incident lines that are on a route usingNavigationVisualizationServiceProtocol.trafficOnRoutes
property by UUID of correspondingTomTomSDKMapDisplay.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.
Declaration
Swift
public protocol NavigationVisualizationServiceProtocol : AnyObject