CarPlayManager

public class CarPlayManager : NSObject
extension CarPlayManager: CPApplicationDelegate
extension CarPlayManager: CPInterfaceControllerDelegate
extension CarPlayManager: CPMapTemplateDelegate
extension CarPlayManager: CarPlayNavigationViewControllerDelegate
extension CarPlayManager: CarPlayMapViewControllerDelegate

CarPlayManager is the main object responsible for orchestrating interactions with a Mapbox map on CarPlay.

Messages declared in the CPApplicationDelegate protocol should be sent to this object in the containing application’s application delegate. Implement CarPlayManagerDelegate in the containing application and assign an instance to the delegate property of your CarPlayManager instance.

Note

It is very important you have a single CarPlayManager instance at any given time. This should be managed by your UIApplicationDelegate class if you choose to supply your accessToken to the CarPlayManager.eventsManager via NavigationEventsManager initializer, instead of the Info.plist.

Important

CarPlayManager view will start a Free Drive session by default when CarPlay interface is connected. You can change default behavior using CarPlayManager.startFreeDriveAutomatically property. For more information, see the “Pricing” guide.

  • A controller that manages the templates for constructing a scene’s user interface.

    Declaration

    Swift

    public fileprivate(set) var interfaceController: CPInterfaceController? { get }
  • Main window for content, presented on the CarPlay screen.

    Declaration

    Swift

    public fileprivate(set) var carWindow: UIWindow? { get }
  • A template that displays a navigation overlay on the map.

    Declaration

    Swift

    public fileprivate(set) var mainMapTemplate: CPMapTemplate? { get }
  • A Boolean value indicating whether the phone is connected to CarPlay.

    Declaration

    Swift

    public static var isConnected: Bool