Contents

CPNavigationSession

An object that represents an active route guidance session.

Declaration

@MainActor class CPNavigationSession

Overview

To start a navigation session, you call startNavigationSession(for:) on the map template, passing the trip the user selected. The map template’s delegate receives the selected trip via mapTemplate(_:startedTrip:using:).

When calculating the initial set of maneuvers, you set pauseTrip(for:description:) to CPNavigationSession.PauseReason.loading so that CarPlay displays the correct state to the user.

During turn-by-turn guidance, you create CPManeuver objects that contain information about upcoming turns, and then update upcomingManeuvers. Maintain at least one maneuver in the array at all times. You should call updateEstimates(_:for:) regularly to update the remaining time and distance for each maneuver.

When CarPlay pauses, finishes, or cancels route guidance, you must call the corresponding method on the active navigation session.

Topics

Getting the Trip

Managing Trip Navigation

Managing Upcoming Maneuvers

Updating Travel Estimates

Instance Properties

Instance Methods

See Also

Navigating a Trip