The Navigation SDK for iOS is only available upon request. Contact us to get started.
The Navigation SDK provides a set of tools that allows you to bring a complete navigation experience to your application. It offers two modes of navigation: turn-by-turn navigation and free driving. In this guide you will see how to set up the project to deploy basic navigation features on your simulator or device.
Project set up
To use the Navigation SDK, you will need to do the following:
- Get your TomTom API key from the Developer Portal. Instructions to request and use the TomTom API key can be found in the TomTom API key user guide.
- Configure the project as described in the project setup guide.
- Add the
TomTomSDKRouteReplannerDefaultdependencies in the
Podfileand execute the
pod installcommand to install the pods.
- Once the project is set up and navigation module is added to your target, import the following frameworks:
import TomTomSDKNavigationEnginesimport TomTomSDKRoute
Creating the Navigation object
Once the Navigation SDK is added to the application, you can create the
Navigation object. To do so use the
NavigationConfiguration to create an instance of
NavigationConfiguration. It requires three parameters:
- apiKey - the TomTom API key.
- locationEngine - the engine that will be used by navigation
- routeReplanner - the
RouteReplannerthat will be used for replanning the route.
Use DefaultRouteReplanner from the
TomTomSDKRouteReplannerDefault module, or create a custom dynamic routing service that uses the
RouteReplanner protocol from
NavigationConfiguration can be used to specify custom engines and parameters related to continuous route replanning and route deviation.
1let configuration = NavigationConfiguration(2 apiKey: "<NAVIGATION-KEY>",3 locationProvider: locationEngine,4 routeReplanner: routeReplanner5)67locationEngine.start()
NavigationConfiguration is initialized, you can create a
Navigation object. It is responsible for interacting with and customizing navigation.
Navigation is used to:
- Start navigation.
- Stop navigation.
- Update the route.
- Report specific events that occur during the navigation.
self.navigation = Navigation(configuration: configuration)
Navigation.start() method to start processing data or start navigation with route:
1let routePlan = RoutePlan(route: route, routingOptions: options)2let navigationOptions = NavigationOptions(activeRoutePlan: routePlan)3navigation.start(navigationOptions: navigationOptions)
Navigation start can be observed. Notification about successfull navigation process start is sent via
NavigationStartObserver::func didStart(with navigationMode: Navigation.NavigationMode).
Once you start a navigation session,
- Request locations from the provided
LocationProvider. Read more about this protocol in the Location quickstart guide.
- Process the incoming locations and send out various events with modified data, such as map matched locations.
- Send out guidance events once navigation has started with the route.
More details how to use navigation can be found in the Turn-by-turn and Free driving guides.