public protocol NavigationActiveRouteChangeObserver : Observer

Informs the caller that 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 update(navigationOptions:) method. Note, if update(navigationOptions:) is called on the current active route, 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 RouteObserver: NavigationActiveRouteChangeObserver { ... }

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

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

This callback function could render the new active route in a different color on the map, for example.

The NavigationActiveRouteChangeObserver is called after the addition of the route to the navigation and prior to the removal of the old active route. Hence, it is called after the NavigationRouteAddObserver and before the NavigationRouteRemoveObserver.


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