public protocol NavigationActiveRouteChangeObserver : Observer

Declares an observer that can receive the active route has changed. The active route is the only followed route for which the navigation provides guidance.

The active route is changed when:

  • The navigation is started with a route using the start() method with NavigationOptions as an argument.
  • Navigation has completed a replanning and a new route is set as the active route.
  • The navigation is updated using the setActiveRoutePlan(_:) method. Note, if setActiveRoutePlan(_:) is called with the currently active RoutePlan, this observer will not receive an active route changed notification.
  • A better route proposal is accepted using the selectActiveRoute(routeId:) method.
  • A better route proposal is accepted by steering onto it.

To receive notifications for active route changes, first implement an observer object that conforms to NavigationActiveRouteChangeObserver, for example:

class CustomRouteObserver: NavigationActiveRouteChangeObserver {
    func didChangeActiveRoute(route:) {
        // add code here that handles the active route being changed

The NavigationActiveRouteChangeObserver is notified after adding the route to the navigation and prior to the removal of the old active route. Hence, it is notified after the NavigationRouteAddObserver and before the NavigationRouteRemoveObserver. Then add this observer using addActiveRouteChangeObserver(_:).

To stop receiving these events, remove the observer using removeActiveRouteChangeObserver(_:).


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