Free driving
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.
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.
func didDetectLocationContext(locationContext: LocationContext) { let speed: Measurement<UnitSpeed> = locationContext.speed let speedLimit: TomTomSDKCommon.SpeedLimit? = locationContext.speedLimit
let countryCode: String? = locationContext.address?.countryCodeISO3 let city: String? = locationContext.address?.municipality let streetName: String? = locationContext.address?.streetName
let functionalRoadClass: Int? = locationContext.road?.functionalRoadClass let isRoadUnderpass: Bool? = locationContext.road?.isUnderpass let isRoadTunnel: Bool? = locationContext.road?.isTunnel let tunnelName: String? = locationContext.road?.tunnelName let isRoadBridge: Bool? = locationContext.road?.isBridge let bridgeName: String? = locationContext.road?.bridgeName}
Next steps
Since you have learned about free driving, here are recommendations for the next steps: