Quickstart

VERSION 0.2.2746
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 TomTomSDKNavigationEngine 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 TomTomSDKNavigationEngine
    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 NavigationConfigurationBuilder to create an instance of NavigationConfiguration. It requires three parameters:

  • navigationKey - 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 = NavigationConfigurationBuilder(
2 navigationKey: "<NAVIGATION-KEY>",
3 locationProvider: locationEngine,
4 routeReplanner: routeReplanner
5)
6.build()
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.