VERSION 0.2.1455

The Routing SDK provides the tools to integrate the TomTom Routing API into an iOS application. It is used to calculate a route between an origin and a destination, using a range of options and taking traffic into account. Read more about TomTom’s Routing parameters.

Project set up

To use the Routing SDK, you will need to do the following:

  1. Get your TomTom API key from the Developer Portal. You can find instructions on how to do this at the How do I get a TomTom API Key? page.

  2. Set up the project - Project set up guide.

  3. Add the Routing and the Online Routing module dependencies in the Podfile and install them by executing the pod install command.

    1SDK_VERSION = '{version}'
    3target 'YourAppTarget' do
    4 use_frameworks!
    5 pod 'TomTomSDKOnlineRouting', SDK_VERSION
    6 pod 'TomTomSDKRouting', SDK_VERSION
  4. Once the project is set up and both routing modules are added to your target, import the following frameworks:

    import TomTomSDKOnlineRouting
    import TomTomSDKRouting

Routing SDK entry point

After all the preparations above, you can initialize the TomTomRoutingService object. It is the entry point for performing routing requests.

1init() {
2 self.routingService = TomTomRoutingService()

You must set the API key before initializing TomTomRoutingService:

1func setupKey() {
2 RoutingOnlineService.routingKey = "<ROUTING-KEY>"

Routing basic usage

The OnlineRouting module can be used to obtain a route between two points. This module has to be used together with the Routing module.

To calculate a route from A to B, you need to provide route planning criteria. They are built using the RoutingOptions class. Once you have a RoutingOptions object, pass it to the planRoute method from the TomTomRoutingService object in order to get the result. Read more about routing options and route planning in the Planning a route guide.

The RoutingOptions object allows you to determine what is returned as part of the planned route by providing SectionType to RoutingOptionsBuilder. Read more about section types in the Route sections guide.

For a more advanced navigation experience, you can add optional intermediate locations to the route. Read more about this feature in the Waypoints and custom routes guide.