CarPlayNavigationViewController
@available(iOS 12.0, *)
open class CarPlayNavigationViewController : UIViewController
extension CarPlayNavigationViewController: StyleManagerDelegate
extension CarPlayNavigationViewController: NavigationServiceDelegate
extension CarPlayNavigationViewController: NavigationMapViewDelegate
CarPlayNavigationViewController
is a fully-featured turn-by-turn navigation UI for CarPlay.
Seealso
NavigationViewController
-
A view indicating what direction the vehicle is traveling towards, snapped to eight cardinal directions in steps of 45°.
This view is hidden by default.
Declaration
Swift
public weak var compassView: CarPlayCompassView!
-
A view that displays the current speed limit.
Declaration
Swift
public weak var speedLimitView: SpeedLimitView!
-
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
public var styles: [Style] { get set }
-
Controls whether the main route style layer and its casing disappears as the user location puck travels over it. Defaults to
false
.If
true
, the part of the route that has been traversed will be rendered with full transparency, to give the illusion of a disappearing route. To customize the color that appears on the traversed section of a route, override thetraversedRouteColor
property for theNavigationMapView.appearance()
.Declaration
Swift
public var routeLineTracksTraversal: Bool { get set }
-
Controls the styling of CarPlayNavigationViewController and its components.
The style can be modified programmatically by using
StyleManager.applyStyle(type:)
.Declaration
Swift
public private(set) var styleManager: StyleManager? { get }
-
Provides methods for creating and sending user feedback.
Declaration
Swift
public var eventsManager: NavigationEventsManager { get }
-
Shows the interface for providing feedback about the route.
Declaration
Swift
public func showFeedback()
-
The view controller’s delegate.
Declaration
Swift
public weak var delegate: CarPlayNavigationViewControllerDelegate?
-
CarPlayManager
instance, which contains mainUIWindow
content and is used byCarPlayNavigationViewController
for presentation.Declaration
Swift
public var carPlayManager: CarPlayManager
-
Provides all routing logic for the user.
See
NavigationService
for more information.Declaration
Swift
public var navigationService: NavigationService
-
The map view showing the route and the user’s location.
Declaration
Swift
public fileprivate(set) var navigationMapView: NavigationMapView? { get }
-
Begins a navigation session along the given trip.
Declaration
Swift
public func startNavigationSession(for trip: CPTrip)
Parameters
trip
The trip to begin navigating along.
-
Ends the current navigation session.
Declaration
Swift
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.
-
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
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.
-
Declaration
Swift
public func location(for styleManager: StyleManager) -> CLLocation?
-
Declaration
Swift
public func styleManager(_ styleManager: StyleManager, didApply style: Style)
-
Declaration
Swift
public func styleManagerDidRefreshAppearance(_ styleManager: StyleManager)
-
Declaration
Swift
public func navigationService(_ service: NavigationService, didArriveAt waypoint: Waypoint) -> Bool
-
Declaration
Swift
public func navigationMapView(_ navigationMapView: NavigationMapView, didAdd finalDestinationAnnotation: PointAnnotation, pointAnnotationManager: PointAnnotationManager)