Quickstart

VERSION 0.13.0
PUBLIC PREVIEW

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:

  1. 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.
  2. Configure the project as described in the project setup guide.
  3. Add the TomTomSDKNavigation and TomTomSDKRouteReplannerDefault dependencies in the Podfile and execute the pod install command to install the pods.
  4. Once the project is set up and navigation module is added to your target, import the following frameworks:
    import TomTomSDKNavigationEngines
    import 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 RouteReplanner that 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 TomTomSDKRouteReplanner.

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: routeReplanner
5)
6
7locationEngine.start()

Once 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)

Starting navigation

Call the 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, Navigation will:

  1. Request locations from the provided LocationProvider. Read more about this protocol in the Location quickstart guide.
  2. Process the incoming locations and send out various events with modified data, such as map matched locations.
  3. 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.

center