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 navigation has completed replanning and set the new replanned route as the active one.
- The navigation is updated using the
update(navigationOptions:)
. - A better route proposal has been accepted using the
selectActiveRoute(routeId:)
method. Note, if theupdate(navigationOptions:)
is called with the same route as the current active one, this observer will not be triggered. - The user is not following the active route as reported by
NavigationRouteTrackingStateUpdateObserver
.
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 theTomTomSDKNavigationEngines/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 theupdate(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.-
Called when a
Route
has been removed from the navigation session.Declaration
Swift
func didRemoveRoute(route: Route, reason: RouteRemovedReason)
Parameters
route
The
Route
that has been removed from the navigation session.reason
The reason for removing the route.