Skip to main content

Major changes in the CarPlay logic in the Navigation SDK v3 since Navigation SDK v2

CarPlayManager

initializes

@MainActor init(navigationProvider: MapboxNavigationProvider, styles: [Style]? = nil)

Properties

var directions: Directions
var routingProvider: RoutingProvider
var simulatesLocations: Bool
var simulatedSpeedMultiplier: Bool

Methods

func beginNavigationWithCarPlay(using currentLocation: CLLocationCoordinate2D)

CarPlayManagerDelegate

Methods

  • The following methods are deprecated now. If you need to get information about your navigation progress use new tripSession() object instead.
func carPlayManager(_ carPlayManager: CarPlayManager,
routeResponse: RouteResponse,
routeIndex: Int,
routeOptions: RouteOptions,
desiredSimulationMode: SimulationMode) -> NavigationService?

func carPlayManager(_ carPlayManager: CarPlayManager,
navigationServiceFor indexedRouteResponse: IndexedRouteResponse,
desiredSimulationMode: SimulationMode) -> NavigationService?

  • The following methods are removed: CarPlayManagerDelegate does not support custom LineLayer, CircleLayer and SymbolLayer for configuration custom destination pins and waypoints.
func carPlayManager(_ carPlayManager: CarPlayManager,
routeLineLayerWithIdentifier identifier: String,
sourceIdentifier: String,
for parentViewController: UIViewController) -> LineLayer?

func carPlayManager(_ carPlayManager: CarPlayManager,
routeCasingLineLayerWithIdentifier identifier: String,
sourceIdentifier: String,
for parentViewController: UIViewController) -> LineLayer?

func carPlayManager(_ carPlayManager: CarPlayManager,
routeRestrictedAreasLineLayerWithIdentifier identifier: String,
sourceIdentifier: String,
for parentViewController: UIViewController) -> LineLayer?

func carPlayManager(_ carPlayManager: CarPlayManager,
waypointCircleLayerWithIdentifier identifier: String,
sourceIdentifier: String) -> CircleLayer?

func carPlayManager(_ carPlayManager: CarPlayManager,
waypointSymbolLayerWithIdentifier identifier: String,
sourceIdentifier: String) -> SymbolLayer?

  • Since NavigationService does not exists on Navigation SDK v3 the following method has been changed:
func carPlayManagerDidBeginNavigation(_ carPlayManager: CarPlayManager)
  • In Navigation SDK v3 method didFailToFetchRouteBetween use type erasure to hide error specification. New method signature looks like this:
func carPlayManager(_ carPlayManager: CarPlayManager,
didFailToFetchRouteBetween waypoints: [Waypoint]?,
options: RouteOptions,
error: Error) -> CPNavigationAlert?

CarPlayMapViewController

initializes

  • Since Navigation SDK v3 use global object which called MapboxNavigation. You have to inject this object inside CarPlayMapViewController to help map own some underneath logic related to tile loading, puck movement and other low level things.
init(core: MapboxNavigation, styles: [Style])

CarPlayMapViewControllerDelegate

Methods

  • The following methods are removed: CarPlayMapViewControllerDelegate does not support custom LineLayer for detailed customization for now.
func carPlayMapViewController(_ carPlayMapViewController: CarPlayMapViewController,
willAdd layer: Layer) -> Layer?
func carPlayMapViewController(_ carPlayMapViewController: CarPlayMapViewController,
routeRestrictedAreasLineLayerWithIdentifier identifier: String,
sourceIdentifier: String) -> LineLayer?
func carPlayMapViewController(_ carPlayMapViewController: CarPlayMapViewController,
routeCasingLineLayerWithIdentifier identifier: String,
sourceIdentifier: String) -> LineLayer?
func carPlayMapViewController(_ carPlayMapViewController: CarPlayMapViewController,
routeLineLayerWithIdentifier identifier: String,
sourceIdentifier: String) -> LineLayer?

CarPlayNavigationViewController

initializes

  • The initializer remained almost the same but now required MapboxNavigation object and AccessToken to get information about your current navigation progress.
init(
accessToken: String,
core: MapboxNavigation,
mapTemplate: CPMapTemplate,
interfaceController: CPInterfaceController,
manager: CarPlayManager,
styles: [Style]? = nil,
navigationRoutes: NavigationRoutes
)

Properties

var navigationService: NavigationService

CarPlayNavigationViewControllerDelegate

Methods

  • The following methods are removed: CarPlayNavigationViewControllerDelegate does not support custom LineLayer, CircleLayer and SymbolLayer for configuration custom destination pins and waypoints.
func carPlayNavigationViewController(_ carPlayNavigationViewController: CarPlayNavigationViewController,
routeLineLayerWithIdentifier identifier: String,
sourceIdentifier: String) -> LineLayer?
func carPlayNavigationViewController(_ carPlayNavigationViewController: CarPlayNavigationViewController,
waypointSymbolLayerWithIdentifier identifier: String,
sourceIdentifier: String) -> SymbolLayer?
func carPlayNavigationViewController(_ carPlayNavigationViewController: CarPlayNavigationViewController,
waypointCircleLayerWithIdentifier identifier: String,
sourceIdentifier: String) -> CircleLayer?
func carPlayNavigationViewController(_ carPlayNavigationViewController: CarPlayNavigationViewController,
routeCasingLineLayerWithIdentifier identifier: String,
sourceIdentifier: String) -> LineLayer?
func carPlayNavigationViewController(_ carPlayNavigationViewController: CarPlayNavigationViewController,
willAdd layer: Layer) -> Layer?
Was this page helpful?