CarPlayNavigationViewController
@objc(MBCarPlayNavigationViewController)
public class CarPlayNavigationViewController : UIViewController
CarPlayNavigationViewController
is a fully-featured turn-by-turn navigation UI for CarPlay.
Seealso
NavigationViewController-
The view controller’s delegate.
Declaration
Swift
@objc public weak var carPlayNavigationDelegate: CarPlayNavigationDelegate? { get set }
-
Provides all routing logic for the user.
See
NavigationService
for more information.Declaration
Swift
@objc public var navigationService: NavigationService
-
The map view showing the route and the user’s location.
Declaration
Swift
@objc public fileprivate(set) var mapView: NavigationMapView?
-
The interface styles available for display.
These are the styles available to the view controller’s internal
StyleManager
object. In CarPlay,Style
objects primarily affect the appearance of the map, not guidance-related overlay views.Declaration
Swift
@objc public var styles: [Style] { get set }
-
Creates a new CarPlay navigation view controller for the given route controller and user interface.
Postcondition
Call
startNavigationSession(for:)
after initializing this object to begin navigation.Declaration
Swift
@objc required public init(navigationService: NavigationService, mapTemplate: CPMapTemplate, interfaceController: CPInterfaceController, manager: CarPlayManager, styles: [Style]? = nil)
Parameters
navigationService
The navigation service managing location updates for the navigation session.
mapTemplate
The map template visible during the navigation session.
interfaceController
The interface controller for CarPlay.
manager
The manager for CarPlay.
styles
The interface styles that the view controller’s internal
StyleManager
object can select from for display. -
Begins a navigation session along the given trip.
Declaration
Swift
@objc(startNavigationSessionForTrip:) public func startNavigationSession(for trip: CPTrip)
Parameters
trip
The trip to begin navigating along.
-
Ends the current navigation session.
Declaration
Swift
@objc(exitNavigationByCanceling:) public func exitNavigation(byCanceling canceled: Bool = false)
Parameters
canceled
A Boolean value indicating whether this method is being called because the user intends to cancel the trip, as opposed to letting it run to completion.
-
Shows the interface for providing feedback about the route.
Declaration
Swift
@objc public func showFeedback()
-
A Boolean value indicating whether the map should follow the user’s location and rotate when the course changes.
When this property is true, the map follows the user’s location and rotates when their course changes. Otherwise, the map shows an overview of the route.
Declaration
Swift
@objc public var tracksUserCourse: Bool { get set }
-
Declaration
Swift
public func navigationMapViewUserAnchorPoint(_ mapView: NavigationMapView) -> CGPoint
-
Declaration
Swift
@objc(locationForStyleManager:) public func location(for styleManager: StyleManager) -> CLLocation?
-
Declaration
Swift
@objc(styleManager:didApplyStyle:) public func styleManager(_ styleManager: StyleManager, didApply style: Style)
-
Declaration
Swift
@objc public func styleManagerDidRefreshAppearance(_ styleManager: StyleManager)