CarPlayManagerDelegate
CarPlayManagerDelegate
is the main integration point for Mapbox CarPlay support.
Implement this protocol and assign an instance to the delegate
property of the shared instance of CarPlayManager
.
If no delegate is set, a default built-in MapboxNavigationService will be created and used when a trip begins.
-
carPlayManager(_:leadingNavigationBarButtonsCompatibleWith:in:for:)
Default implementationOffers the delegate an opportunity to provide a customized list of leading bar buttons at the root of the template stack for the given activity.
These buttons’ tap handlers encapsulate the action to be taken, so it is up to the developer to ensure the hierarchy of templates is adequately navigable.
Default Implementation
-
carPlayManager(_:trailingNavigationBarButtonsCompatibleWith:in:for:)
Default implementationOffers the delegate an opportunity to provide a customized list of trailing bar buttons at the root of the template stack for the given activity.
These buttons’ tap handlers encapsulate the action to be taken, so it is up to the developer to ensure the hierarchy of templates is adequately navigable.
Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. SeeUnimplementedLogging
for details.Default Implementation
-
carPlayManager(_:mapButtonsCompatibleWith:in:for:)
Default implementationOffers the delegate an opportunity to provide a customized list of buttons displayed on the map.
These buttons handle the gestures on the map view, so it is up to the developer to ensure the map template is interactive. If this method is not implemented, or if nil is returned, a default set of zoom and pan buttons declared in the
CarPlayMapViewController
will be provided.Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. SeeUnimplementedLogging
for details.Default Implementation
-
Asks the delegate to provide a navigation service. In multi-screen applications this should be the same instance used to guide the user along the route on the phone.
Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. SeeUnimplementedLogging
for details. -
carPlayManager(_:searchTemplate:updatedSearchText:completionHandler:)
Default implementationOffers the delegate an opportunity to react to updates in the search text.
Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. See
UnimplementedLogging
for details.Postcondition
You must call
completionHandler
within this method.Default Implementation
-
carPlayManager(_:searchTemplate:selectedResult:completionHandler:)
Default implementationOffers the delegate an opportunity to react to selection of a search result.
Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. See
UnimplementedLogging
for details.Postcondition
You must call
completionHandler
within this method.Default Implementation
-
carPlayManager(_:didFailToFetchRouteBetween:options:error:)
Default implementationCalled when the CarPlay manager fails to fetch a route.
Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. SeeUnimplementedLogging
for details.Default Implementation
-
carPlayManager(_:willPreview:)
Default implementationOffers the delegate the opportunity to customize a trip before it is presented to the user to preview.
To customize the destination’s title, which is displayed when a route is selected, set the
MKMapItem.name
property of theCPTrip.destination
property. To add a subtitle, create a newMKMapItem
whoseMKPlacemark
has theStreet
key in its address dictionary.Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. SeeUnimplementedLogging
for details.Default Implementation
-
carPlayManager(_:willPreview:with:)
Default implementationOffers the delegate the opportunity to customize a trip preview text configuration for a given trip.
Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. SeeUnimplementedLogging
for details.Default Implementation
-
carPlayManager(_:selectedPreviewFor:using:)
Default implementationOffers the delegate the opportunity to react to selection of a trip. Certain trips may have alternate route(s).
Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. SeeUnimplementedLogging
for details.Default Implementation
-
carPlayManager(_:didBeginNavigationWith:)
Default implementationCalled when navigation begins so that the containing app can update accordingly.
Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. SeeUnimplementedLogging
for details.Default Implementation
-
carPlayManagerDidEndNavigation(_:)
Default implementationCalled when navigation ends so that the containing app can update accordingly.
Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. SeeUnimplementedLogging
for details.Default Implementation
-
carplayManagerShouldDisableIdleTimer(_:)
Default implementationCalled when the carplay manager will disable the idle timer.
Implementing this method will allow developers to change whether idle timer is disabled when carplay is connected and the vice-versa when disconnected.
Note
This delegate method includes a default implementation that prints a warning to the console when this method is called. SeeUnimplementedLogging
for details.Default Implementation