Free driving

VERSION 0.45.0
PUBLIC PREVIEW

The Navigation SDK for iOS is only available upon request. Contact us to get started.

When you use navigation without a specified route, it’s called free driving. Free driving provides detailed information about the current location such as speed, speed limit, country code, street name, road characteristics, and so on.

At any time, you can switch from free driving mode to turn-by-turn navigation using the TomTomNavigation.setActiveRoutePlan(_:) method. You can learn more about updating the Route in the Update route guide.

Start navigation

First, add the navigation module to your project and set up a TomTomNavigation object. Learn how to do this in the Quickstart guide.

Once TomTomNavigation is initialized, you can start navigation using the TomTomNavigation.start() method.

try navigation.start()

Stop navigation

To stop any currently running navigation use the TomTomNavigation.stop() method. This method also clears all data related to navigation. If navigation has not been started, the stop method has no effect.

navigation.stop()

Current location context updates

To get current location context updates, set up a NavigationLocationContextObserver.didDetectLocationContext(locationContext:) callback. More details about location context can be found in the location context guide.

1func didDetectLocationContext(locationContext: LocationContext) {
2 let speed: Measurement<UnitSpeed> = locationContext.speed
3 let speedLimit: TomTomSDKCommon.SpeedLimit? = locationContext.speedLimit
4
5 let countryCode: String? = locationContext.address?.countryCodeISO3
6 let city: String? = locationContext.address?.municipality
7 let streetName: String? = locationContext.address?.streetName
8
9 let functionalRoadClass: Int? = locationContext.road?.functionalRoadClass
10 let isRoadUnderpass: Bool? = locationContext.road?.isUnderpass
11 let isRoadTunnel: Bool? = locationContext.road?.isTunnel
12 let tunnelName: String? = locationContext.road?.tunnelName
13 let isRoadBridge: Bool? = locationContext.road?.isBridge
14 let bridgeName: String? = locationContext.road?.bridgeName
15}
center

Next steps

Since you have learned about free driving, here are recommendations for the next steps: