CarPlayMapViewController
open class CarPlayMapViewController : UIViewController
extension CarPlayMapViewController: StyleManagerDelegate
extension CarPlayMapViewController: NavigationMapViewDelegate
extension CarPlayMapViewController: CPSessionConfigurationDelegate
CarPlayMapViewController
is responsible for administering the Mapbox map, the interface styles and the map template buttons to display on CarPlay.
Important
LoadingCarPlayMapViewController
view will start a Free Drive session by default. You can change default behavior using CarPlayMapViewController.startFreeDriveAutomatically
property. For more information, see the “Pricing” guide.
-
The view controller’s delegate, that is used by the
CarPlayManager
.Do not overwrite this property and use
CarPlayManagerDelegate
methods directly.Declaration
Swift
public weak var delegate: CarPlayMapViewControllerDelegate?
-
Controls the styling of CarPlayMapViewController and its components.
The style can be modified programmatically by using
StyleManager.applyStyle(type:)
.Declaration
Swift
public private(set) var styleManager: StyleManager? { get }
-
A view that displays the current speed limit.
Declaration
Swift
public var speedLimitView: SpeedLimitView!
-
A view that displays the current road name.
Declaration
Swift
public var wayNameView: WayNameView!
-
An optional metadata to be provided as initial value of
NavigationEventsManager.userInfo
property.Declaration
Swift
public var userInfo: [String : String?]?
-
Controls whether
CarPlayMapViewController
starts a Free Drive session automatically on map load.If you set this property to false, you can start a Free Drive session using
CarPlayMapViewController.startFreeDriveNavigation()
method.Declaration
Swift
public var startFreeDriveAutomatically: Bool
-
The map button for recentering the map view if a user action causes it to stop following the user.
Declaration
Swift
public lazy var recenterButton: CPMapButton { get set }
-
The map button for zooming in the current map view.
Declaration
Swift
public lazy var zoomInButton: CPMapButton { get set }
-
The map button for zooming out the current map view.
Declaration
Swift
public lazy var zoomOutButton: CPMapButton { get set }
-
The map button property for hiding or showing the pan map button.
Declaration
Swift
public internal(set) var panMapButton: CPMapButton? { get }
-
The map button property for exiting the pan map mode.
Declaration
Swift
public internal(set) var dismissPanningButton: CPMapButton? { get }
-
Creates a new pan map button for the CarPlay map view controller.
Declaration
Swift
@discardableResult public func panningInterfaceDisplayButton(for mapTemplate: CPMapTemplate) -> CPMapButton
Parameters
mapTemplate
The map template available to the pan map button for display.
Return Value
CPMapButton
instance. -
Creates a new close button to dismiss the visible panning buttons on the map.
Declaration
Swift
@discardableResult public func panningInterfaceDismissalButton(for mapTemplate: CPMapTemplate) -> CPMapButton
Parameters
mapTemplate
The map template available to the pan map button for display.
Return Value
CPMapButton
instance.
-
Initializes a new CarPlay map view controller.
Declaration
Swift
public required init(styles: [Style])
Parameters
styles
The interface styles initially available to the style manager for display.
-
Returns a
CarPlayMapViewController
object initialized from data in a given unarchiver.Declaration
Swift
public required init?(coder decoder: NSCoder)
Parameters
coder
An unarchiver object.
-
Starts a Free Drive session if it is not started already.
Free Drive session starts automatically on map load by default. You can change this behavior using
CarPlayMapViewController.startFreeDriveAutomatically
method.Note
Paused Free Drive sessions are not resumed by this method.Declaration
Swift
public func startFreeDriveNavigation()
-
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 navigationMapView(_ navigationMapView: NavigationMapView, didAdd finalDestinationAnnotation: PointAnnotation, pointAnnotationManager: PointAnnotationManager)
-
Declaration
Swift
public func navigationMapView(_ navigationMapView: NavigationMapView, routeLineLayerWithIdentifier identifier: String, sourceIdentifier: String) -> LineLayer?
-
Declaration
Swift
public func navigationMapView(_ navigationMapView: NavigationMapView, routeCasingLineLayerWithIdentifier identifier: String, sourceIdentifier: String) -> LineLayer?
-
Declaration
Swift
public func navigationMapView(_ navigationMapView: NavigationMapView, routeRestrictedAreasLineLayerWithIdentifier identifier: String, sourceIdentifier: String) -> LineLayer?
-
Declaration
Swift
public func navigationMapView(_ navigationMapView: NavigationMapView, willAdd layer: Layer) -> Layer?