Navigation visualization
You can use the Navigation Visualization add-on to provide users with a basic navigation experience by visualizing navigation features such as routes and guidance.
Project setup
The Navigation SDK for iOS is only available upon request. Contact us to get started.
- Configure the project as described in the Project setup guide.
- Add the Navigation Visualization add-on dependency in the
Podfile
1target 'YourAppTarget' do2 use_frameworks!3 (...)4 pod 'TomTomSDKAddonNavigationVisualization'5 (...)6end
Creating a Navigation Visualization entry point
Use the NavigationVisualizationServiceBuilderProtocol.build
method to create the NavigationVisualizationServiceProtocol
instance. It takes three arguments:
map
: aTomTomMap
object.navigation
: aNavigation
object.styleConfiguration
: aStyleConfiguration
object. This is an optional object; if it’s not passed, then the default style will be used.
1var navigationVisualizationService: NavigationVisualizationServiceProtocol!23func buildNavigationVisualizationService(4 map: TomTomMap,5 navigation: Navigation,6 styleConfiguration: StyleConfiguration7) throws {8 navigationVisualizationService = try NavigationVisualizationServiceBuilder().build(9 map: map,10 navigation: navigation,11 styleConfiguration: styleConfiguration12 )13}
Displaying routes
Pass a set of routes to the displayRoutes
to show them on the map.
1func displayRoutes(routes: [TomTomSDKRoute.Route]) {2 navigationVisualizationService.displayRoutes(routes: routes)3}
By default, the first Route
is selected, and all others are marked as alternatives.
The selected Route
can be changed by using the selectRoute
method. This method takes a Route
object that is part of the displayed Route
collection as an argument.
1func selectRoute(_ route: TomTomSDKMapDisplay.Route) {2 navigationVisualizationService.selectRoute(route)3}

Displaying the selected route during navigation
Once Navigation.start
is called to start the navigation session, the selected route becomes the active Route
. During its lifecycle, the NavigationVisualizationServiceProvider
object subscribes to different navigation events in order to display information about route progress.
The navigation session can be stopped by calling the Navigation.stop
method.

Next steps
Now that you’ve set up the addon, here are some suggestions to extend the functionality: