NavigationRouteRemoveObserver

public protocol NavigationRouteRemoveObserver : Observer

Declares an observer that can receive the active or proposed route has been removed from the navigation session.

The active route is removed from the session when:

The proposed route is removed from the session when:

  • The user is not following the route, as reported by NavigationRouteTrackingStateUpdateObserver resulting in the proposed route being placed in the TomTomSDKNavigationEngines/RouteTrackingState/unfollowedRoutes list.
  • The navigation has finished planning a new route due to replanning initiated by the navigation.
  • The navigation is updated using the setActiveRoutePlan(_:) method. Note, if the setActiveRoutePlan(_:) is called with the same route as the proposed one, this observer will not be notified.

To receive notifications of a route being removed from the session, first implement an observer object that conforms to NavigationRouteRemoveObserver, for example:

class CustomRouteObserver: NavigationRouteRemoveObserver { ... }

/// In order to complete conformance, the observer object must implement the following callback:

func didRemoveRoute(route: reason:) {
    // add code here that handles the route being removed from the session
}

This callback function could remove a rendered route from the map, for example.

Next, add this observer with navigation using addRouteRemoveObserver(_:). To stop notifications of a route being removed from the session, remove the observer using removeRouteRemoveObserver(_:).

The complementary observer that provides updates on the addition of routes to the session is NavigationRouteAddObserver. Note, during navigation in turn by turn mode there will always be one active route. Therefore, any removal of the current active route will always be preceded by an NavigationActiveRouteChangeObserver call, with details of the new active route.