Major changes in the CarPlay logic in the Navigation SDK v3 since Navigation SDK v2
CarPlayManager
initializes
- The main difference is that the old deprecated initializes have been removed and added new initializes for creating
CarPlayManager
. To get instance ofMapboxNavigationProvider
reach out the main migration guide for SDK v3
@MainActor init(navigationProvider: MapboxNavigationProvider, styles: [Style]? = nil)
Properties
directions
have been removed. If you want to get any information about current route, useRoutingProvider()
instead.
var directions: Directions
routingProvider
have been removed. If you want to get any information about current route, use new instance ofRoutingProvider()
instead.
var routingProvider: RoutingProvider
simulatesLocations
andsimulatedSpeedMultiplier
have been removed. CarPlay Navigation SDK v3 does not support location simulation configuration for now.
var simulatesLocations: Bool
var simulatedSpeedMultiplier: Bool
Methods
- From method
beginNavigationWithCarPlay
removed parameternavigationService
. If you want to get information about your current route, usetripSession()
instead.
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 customLineLayer
,CircleLayer
andSymbolLayer
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 insideCarPlayMapViewController
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 customLineLayer
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 andAccessToken
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
- The property of
navigationService
does not longer exists. If you want to get the information about your current navigation progress useMapboxNavigation
instead.
var navigationService: NavigationService
CarPlayNavigationViewControllerDelegate
Methods
- The following methods are removed:
CarPlayNavigationViewControllerDelegate
does not support customLineLayer
,CircleLayer
andSymbolLayer
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?