DefaultTomTomNavigation

@available(*, deprecated, message: "This API is deprecated and will be removed with the next major release.")
public class DefaultTomTomNavigation : TomTomNavigation

The DefaultTomTomNavigation object defines the functionality of the navigation.

The DefaultTomTomNavigation class offers functionalities to start, stop, and manage navigation sessions. It integrates with TomTom services to provide real-time navigation guidance and updates.

let navigation = DefaultTomTomNavigation()
navigation.startNavigation()

Important

DefaultTomTomNavigation isn’t thread-safe and it’s recommended to make API calls always on the same thread.
  • HorizonError defines errors related to adding or removing observers.

    Important

    This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public enum HorizonError : Error
  • Provides access to currently added engines and allows updating them.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var navigationEngineRegistry: NavigationEngineRegistry
  • The VehicleProvider used by the DefaultTomTomNavigation for providing vehicle updates to the navigation.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public let vehicleProvider: VehicleProvider
  • The current NavigationState. The initial value is set to idle.

    The navigationState property represents the current state of navigation. It allows you to monitor and determine the current status of the navigation process managed by DefaultTomTomNavigation.

    To change the navigationState, you can utilize the following methods:

    To observe changes to navigationState see NavigationStateChangeObserver protocol.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var navigationState: NavigationState { get }
  • The current BetterProposalAcceptanceMode.

    The betterProposalAcceptanceMode property allows you to get or set the current mode for better proposal acceptance in the navigation process. To change the betterProposalAcceptanceMode, simply set this property to one of the available modes from BetterProposalAcceptanceMode.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var betterProposalAcceptanceMode: TomTomSDKNavigationEngines.BetterProposalAcceptanceMode { get set }
  • The unit system to be used within DefaultTomTomNavigation.

    Once set, it is propagated to other components (e.g. GuidanceEngine) and used for the generation of guidance announcements.

    If the UnitSystemType instance is dynamic then unitSystem is resolved based on the country attribute of the current location:

    • for “USA” and “PRI” it will resolve to SpecificUnitSystem/imperialFeet.
    • for “GBR” it will resolve to SpecificUnitSystem/imperialYards.
    • for other countries it will resolve to SpecificUnitSystem/metric.

    The default value is UnitSystemType.default.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var unitSystem: UnitSystemType { get set }
  • The current language for guidance instructions and announcement language.

    The initial value is Locale.current. To change the language, use to the preferredLanguage property.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var language: Locale { get }
  • The preferred language for guidance instructions and announcement language.

    The initial value is Locale.current. If the initial language is not supported, en-US will be used instead. Supported languages can be acquired from GuidanceEngine.availableLanguages.

    Setting the preferred language updates the route. You can check the updated route language using language. If the specified language is not supported, en-US will be used instead.

    To observe language changes, add:

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var preferredLanguage: Locale { get set }
  • Provides a map-matched CLLocation.

    The map-matched location provider is responsible for providing locations that have been adjusted to snap to the nearest road or path on the map.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var mapMatchedLocationProvider: LocationProvider { get }
  • Provides a CLLocation for raw GPS position.

    Allows getting and setting the LocationProvider instance used by the navigation system. The location provider is responsible for providing the current location to the navigation system.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var locationProvider: LocationProvider { get set }
  • A publisher that emits navigation events as they occur.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var eventPublisher: AnyPublisher<NavigationEvent, Never> { get }
  • Controls how the route deviations are handled.

    When set to automatic the navigation replans the route automatically. When set to none the navigation does not replan the route.

    The default value is automatic.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var deviationReplanningMode: DeviationReplanningMode { get set }
  • The current NavigationSnapshot.

    navigationSnapshot is nil at the start of navigation in the following situations:

    • If the location provider is disabled.
    • If the location provider is enabled but unable to find the location.

    Note

    Once navigationSnapshot is defined, it remains defined throughout the navigation session.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var navigationSnapshot: NavigationSnapshot? { get }
  • Adds a NavigationStateChangeObserver to DefaultTomTomNavigation. The observer is notified of changes to the navigationState.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addNavigationStateChangeObserver(_ observer: NavigationStateChangeObserver)

    Parameters

    observer

    A class that can handle navigation state changes.

  • Removes a previously added NavigationStateChangeObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeNavigationStateChangeObserver(_ observer: NavigationStateChangeObserver)

    Parameters

    observer

    A class that can handle navigation state changes.

  • Adds a LocationMapMatchingObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addLocationMapMatchingObserver(_ observer: LocationMapMatchingObserver)

    Parameters

    observer

    A class that can handle navigation map matching events.

  • Removes a previously added LocationMapMatchingObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeLocationMapMatchingObserver(_ observer: LocationMapMatchingObserver)

    Parameters

    observer

    A class that can handle navigation map matching events.

  • Adds a NavigationProgressObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addProgressObserver(_ observer: NavigationProgressObserver)

    Parameters

    observer

    A class that can handle navigation start events.

  • Removes a previously added NavigationProgressObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeProgressObserver(_ observer: NavigationProgressObserver)

    Parameters

    observer

    A class that can handle navigation progress events.

  • Adds a NavigationRouteAddObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addRouteAddObserver(_ observer: NavigationRouteAddObserver)

    Parameters

    observer

    A class that can handle navigation route added events.

  • Removes a previously added NavigationRouteAddObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeRouteAddObserver(_ observer: NavigationRouteAddObserver)

    Parameters

    observer

    A class that can handle navigation route added events.

  • Adds a NavigationRouteRemoveObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addRouteRemoveObserver(_ observer: NavigationRouteRemoveObserver)

    Parameters

    observer

    A class that can handle navigation route removed events.

  • Removes a previously added NavigationRouteRemoveObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeRouteRemoveObserver(_ observer: NavigationRouteRemoveObserver)

    Parameters

    observer

    A class that can handle navigation route removed events.

  • Adds a NavigationRouteUpdateObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addRouteUpdateObserver(_ observer: NavigationRouteUpdateObserver)

    Parameters

    observer

    A class that can handle navigation route updated events.

  • Removes a previously added NavigationRouteUpdateObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeRouteUpdateObserver(_ observer: NavigationRouteUpdateObserver)

    Parameters

    observer

    A class that can handle navigation route updated events.

  • Adds a NavigationActiveRouteChangeObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addActiveRouteChangeObserver(_ observer: NavigationActiveRouteChangeObserver)

    Parameters

    observer

    A class that can handle navigation active route changed events.

  • Removes a previously added NavigationActiveRouteChangeObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeActiveRouteChangeObserver(_ observer: NavigationActiveRouteChangeObserver)

    Parameters

    observer

    A class that can handle navigation active route changed events.

  • Adds a GuidanceUpdateObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addGuidanceUpdateObserver(_ observer: GuidanceUpdateObserver)

    Parameters

    observer

    A class that can handle navigation guidance events.

  • Removes a previously added GuidanceUpdateObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeGuidanceUpdateObserver(_ observer: GuidanceUpdateObserver)

    Parameters

    observer

    A class that can handle navigation guidance events.

  • Adds a LaneGuidanceUpdateObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addLaneGuidanceUpdateObserver(_ observer: LaneGuidanceUpdateObserver)

    Parameters

    observer

    A class that can handle navigation guidance events.

  • Removes a previously added LaneGuidanceUpdateObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeLaneGuidanceUpdateObserver(_ observer: LaneGuidanceUpdateObserver)

    Parameters

    observer

    A class that can handle navigation guidance events.

  • Adds a NavigationGuidanceObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addGuidanceObserver(_ observer: NavigationGuidanceObserver)

    Parameters

    observer

    A class that can handle navigation guidance events.

  • Removes a previously added NavigationGuidanceObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeGuidanceObserver(_ observer: NavigationGuidanceObserver)

    Parameters

    observer

    A class that can handle navigation guidance events.

  • Adds a NavigationLocationContextObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addLocationContextObserver(_ observer: NavigationLocationContextObserver)

    Parameters

    observer

    A class that can handle navigation location context events.

  • Removes a previously added NavigationLocationContextObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeLocationContextObserver(_ observer: NavigationLocationContextObserver)

    Parameters

    observer

    A class that can handle navigation location context events.

  • Adds a NavigationDestinationArrivalObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addDestinationArrivalObserver(_ observer: NavigationDestinationArrivalObserver)

    Parameters

    observer

    A class that can handle navigation arrival events.

  • Removes a previously added NavigationDestinationArrivalObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeDestinationArrivalObserver(_ observer: NavigationDestinationArrivalObserver)

    Parameters

    observer

    A class that can handle navigation arrival events.

  • Adds a NavigationWaypointArrivalObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addWaypointArrivalObserver(_ observer: NavigationWaypointArrivalObserver)

    Parameters

    observer

    A class that can handle navigation arrival events.

  • Removes a previously added NavigationWaypointArrivalObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeWaypointArrivalObserver(_ observer: NavigationWaypointArrivalObserver)

    Parameters

    observer

    A class that can handle navigation arrival events.

  • Adds a NavigationHorizonObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Throws

    Throws:

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addHorizonObserver(_ observer: NavigationHorizonObserver, options: HorizonOptions) throws

    Parameters

    observer

    A class that can handle navigation horizon events. To add a new observer with the same options, the previous one must be removed first. To add different options with the same observer, the previous one must be removed first.

    options

    The options that define the extent of the paths on the horizon and which map attributes to collect.

  • Removes a previously added NavigationHorizonObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeHorizonObserver(_ observer: NavigationHorizonObserver) throws

    Parameters

    observer

    A class that can handle navigation trip events.

  • Adds a NavigationRouteTrackingStateUpdateObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Declaration

    Swift

    public func addRouteTrackingStateUpdateObserver(_ observer: NavigationRouteTrackingStateUpdateObserver)

    Parameters

    observer

    A class that can handle navigation follow the route events.

  • Removes a previously added NavigationRouteTrackingStateUpdateObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Declaration

    Swift

    public func removeRouteTrackingStateUpdateObserver(_ observer: NavigationRouteTrackingStateUpdateObserver)

    Parameters

    observer

    A class that can handle navigation follow the route events.

  • Adds a NavigationLanguageChangeObserver to DefaultTomTomNavigation.

    This method must be called on the main queue. The system maintains a weak reference to the observer.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func addLanguageChangeObserver(_ observer: NavigationLanguageChangeObserver)

    Parameters

    observer

    A class that can handle navigation language change events.

  • Removes a previously added NavigationLanguageChangeObserver from DefaultTomTomNavigation.

    No need to remove the observer manually; the system will handle it when the next event occurs. Ensure this method is called on the main queue. Avoid calling this method from the observer’s deinitializer unless you are sure it will be destroyed on the main queue.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func removeLanguageChangeObserver(_ observer: NavigationLanguageChangeObserver)

    Parameters

    observer

    A class that can report on changes to the navigation language.

  • Starts navigation without specifying a Route. Use this method to start the navigation in free driving mode.

    Navigation goes through the following steps:

    As a result of successful action, the following observer is notified:

    Throws

    An error if navigation has already started.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func start() throws
  • Starts navigation with the provided NavigationOptions. Use this method to start the navigation in active guidance mode with the provided Route within the NavigationOptions.

    Navigation goes through the following steps:

    Additionally, the system performs the following operations for the active, i.e., currently navigated Route within the NavigationOptions:

    As a result of successful action, the following observer is notified:

    Throws

    An error if navigation has already started or if NavigationOptions are incompatible with navigation configuration.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func start(navigationOptions: NavigationOptions) throws

    Parameters

    navigationOptions

    Details of the navigation options for starting the navigation session. Vehicle provided for navigation must be compatible with the given activeRoutePlan.

  • Updates the route plan during ongoing navigation.

    The following listeners are notified:

    • NavigationRouteUpdateObserver/didUpdateRoute(route:options:reason:) with the updated Route, RoutePlanniningOptions and RouteUpdatedReason/manuallyUpdated if current route does not contain the provided routeId, the method does not update the route.
    • didChangeActiveRoute(route:) with the Route if active route has changed.
    • didRemoveRoute(route:reason:) with all other routes except the active Route and manual.

    Throws

    An error if RoutePlan is incompatible with navigation configuration.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func setActiveRoutePlan(_ routePlan: RoutePlan) throws

    Parameters

    routePlan

    The RoutePlan to be set as active. Vehicle provided for navigation must be compatible with the given RoutePlan.

  • Selects the Route with provided routeID as active.

    The navigation switches to navigate along the desired route and the following listeners are notified:

    Declaration

    Swift

    public func selectActiveRoute(routeId: UUID)

    Parameters

    routeId

    UUID id of route that should be selected.

  • Marks a departure from the given waypoint independently from ArrivalDetectionEngine/hasArrivedAtWaypoint.

    The specified waypoint is marked as having been departed from and NavigationWaypointArrivalObserver are notified about this via NavigationDestinationArrivalObserver/didArriveAtWaypoint(waypoint:on:). Notification via NavigationDestinationArrivalObserver/didArriveAtWaypoint(waypoint:on:) completes arrival detection for that particular waypoint. Navigation switches to arrival detection for the next waypoint, if one is present.

    Prerequisites for this action:

    Throws

    nextWaypointError if calling requirements are not met.

    Declaration

    Swift

    public func departFromWaypoint(waypoint: RouteStop) throws

    Parameters

    waypoint

    The waypoint to depart from.

  • Stops current navigation session and clears data related to it.

    If start has not been called previously, this method has no effect.

    As a result of successful action, the following observer is notified:

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func stop()