NavigationRouteAddObserver
public protocol NavigationRouteAddObserver : ObserverDeclares an observer that can receive a route has been added to the navigation session.
A new route can be added to the session under the following circumstances:
- When navigation has started with a route using the start()method withNavigationOptionsas an argument.
- When navigation is updated using the setActiveRoutePlan(_:)method. Note, if the new route is identical, which means it has the sameRoute/idas the current active route, it will not notify the observer.
- When navigation finds a better route and the TomTomSDKNavigationEngines/BetterProposalAcceptanceModeis set to eitherTomTomSDKNavigationEngines/BetterProposalAcceptanceMode/manualorTomTomSDKNavigationEngines/BetterProposalAcceptanceMode/unreachableOnly.
- When navigation finds a reachable route and TomTomSDKNavigationEngines/BetterProposalAcceptanceModeis set toTomTomSDKNavigationEngines/BetterProposalAcceptanceMode/manual.
- When navigation finds a reachable route, due to the navigated route being unreachable, and TomTomSDKNavigationEngines/BetterProposalAcceptanceModeis set toTomTomSDKNavigationEngines/BetterProposalAcceptanceMode/unreachableOnlyso that the reachable route is automatically applied.
- When the TomTomSDKNavigationEngines/BetterProposalAcceptanceModeis set toTomTomSDKNavigationEngines/BetterProposalAcceptanceMode/automaticand the proposed route is automatically applied.
- When navigation automatically replans and adds the newly planned route to the session.
- When the preferredLanguageis set and the replanning with the new language has completed.
To receive notifications of a route being added to the session, first implement an observer object that conforms to NavigationRouteAddObserver, for example:
class CustomRouteObserver: NavigationRouteAddObserver { ... }
In order to complete conformance, the observer object must implement the following callback:
func didAddRoute(route: options: reason:) {
    // add code here that handles the route being added to the session
}
This callback function could render the newly added route on the map, for example.
Next, add this observer with navigation using addRouteAddObserver(_:).
To stop notifications of a route being added to the session, remove the observer using removeRouteAddObserver(_:).
Please note that NavigationRouteAddObserver is notified only when the replanned route differs from the current active route in terms of geometry.
Events like route refresh and increment update of guidance instructions will not notify this observer.
For these scenarios the NavigationRouteUpdateObserver is notified.
The complementary observer that notifies on the removal of routes from the session is NavigationRouteRemoveObserver.
Important
The addition of a route to the session does not necessarily make it active. To receive notifications of changes to the active route, use theNavigationActiveRouteChangeObserver.
- 
                  
                  Notifies when a Routehas been added to the navigation session.DeclarationSwift func didAddRoute(route: Route, options: RoutePlanningOptions, reason: RouteAddedReason)ParametersrouteThe Routethat has been added to the navigation session.optionsThe RoutePlanningOptionsthat has been used forRoute.reasonThe reason for adding the Route.
 
         TomTom SDK for iOS (0.53.1)
 
          TomTom SDK for iOS (0.53.1)
         NavigationRouteAddObserver
          NavigationRouteAddObserver