メインコンテンツまでスキップ

Route progress

Tracking a user's progress along a route is key to providing helpful and prompt navigation instructions. The RouteProgress class contains all the user's progress information along the route, including current leg and step information. This object allows you to get distance measurements, the percentage of route complete, current step index, and more.

The RouteController tracks the user’s progress along a route, continuously provides an updated RouteProgress object, and posts notifications as the user reaches significant points along the route.

Information about progress

There are three classes that contain information on route progress at different levels of granularity: route, leg, and step.

Route: The blue line represents a route. A route stretches between the origin and destination.

Leg: The larger circles with a pink stroke represent waypoints, or stops, along the route. A leg is the part of the route between two waypoints.

Step: The smaller circles with a green stroke represent maneuvers. A step is the part of the leg between two maneuvers.

Read more about what properties are available in these three progress classes in the API reference documentation:

  • RouteProgress: This class contains all progress information at any given time during a navigation session. This progress includes information for the current route, leg and step the user is traversing along. With every new valid location update, the route progress will be updated with the latest information. You can listen for routeControllerProgressDidChange notifications or implement the corresponding delegate method, NavigationServiceDelegate.navigationService(_:didUpdate:with:rawLocation:) to be notified when the route progress object changes.
  • RouteLegProgress: This class is specific to the current leg the user is on. If there is only one leg in the directions route, much of this information will be the same as the parent RouteProgress.
  • RouteStepProgress: This class is specific to the current step the user is on.
このpageは役に立ちましたか?