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 ofMapboxNavigationProviderreach out the main migration guide for SDK v3
@MainActor init(navigationProvider: MapboxNavigationProvider, styles: [Style]? = nil)
Properties
directionshave been removed. If you want to get any information about current route, useRoutingProvider()instead.
var directions: Directions
routingProviderhave been removed. If you want to get any information about current route, use new instance ofRoutingProvider()instead.
var routingProvider: RoutingProvider
simulatesLocationsandsimulatedSpeedMultiplierhave been removed. CarPlay Navigation SDK v3 does not support location simulation configuration for now.
var simulatesLocations: Bool
var simulatedSpeedMultiplier: Bool
Methods
- From method
beginNavigationWithCarPlayremoved 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:
CarPlayManagerDelegatedoes not support customLineLayer,CircleLayerandSymbolLayerfor 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
NavigationServicedoes not exists on Navigation SDK v3 the following method has been changed:
func carPlayManagerDidBeginNavigation(_ carPlayManager: CarPlayManager)
- In Navigation SDK v3 method
didFailToFetchRouteBetweenuse 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 insideCarPlayMapViewControllerto 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:
CarPlayMapViewControllerDelegatedoes not support customLineLayerfor 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
MapboxNavigationobject andAccessTokento 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
navigationServicedoes not longer exists. If you want to get the information about your current navigation progress useMapboxNavigationinstead.
var navigationService: NavigationService
CarPlayNavigationViewControllerDelegate
Methods
- The following methods are removed:
CarPlayNavigationViewControllerDelegatedoes not support customLineLayer,CircleLayerandSymbolLayerfor 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?
このpageは役に立ちましたか?