Free driving
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 theRoute
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.speed3 let speedLimit: TomTomSDKCommon.SpeedLimit? = locationContext.speedLimit45 let countryCode: String? = locationContext.address?.countryCodeISO36 let city: String? = locationContext.address?.municipality7 let streetName: String? = locationContext.address?.streetName89 let functionalRoadClass: Int? = locationContext.road?.functionalRoadClass10 let isRoadUnderpass: Bool? = locationContext.road?.isUnderpass11 let isRoadTunnel: Bool? = locationContext.road?.isTunnel12 let tunnelName: String? = locationContext.road?.tunnelName13 let isRoadBridge: Bool? = locationContext.road?.isBridge14 let bridgeName: String? = locationContext.road?.bridgeName15}
Next steps
Since you have learned about free driving, here are recommendations for the next steps: