NavigationRouteRemoveObserver

public protocol NavigationRouteRemoveObserver : Observer

Informs the caller that 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 update(navigationOptions:) method. Note, if the update(navigationOptions:) is called with the same route as the proposed one, this observer will not be triggered.

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

class RouteObserver: 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, register this observer with navigation using addRouteRemoveObserver(_:). To stop notifications of a route being removed from the session, unregister 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.

Important

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