CarPlayManager

@available(iOS 12.0, *)
public class CarPlayManager : NSObject
extension CarPlayManager: CPApplicationDelegate
extension CarPlayManager: CPInterfaceControllerDelegate
extension CarPlayManager: CPMapTemplateDelegate
extension CarPlayManager: CarPlayNavigationViewControllerDelegate
extension CarPlayManager: CarPlayMapViewControllerDelegate

CarPlayManager is the main object responsible for orchestrating interactions with a Mapbox map on CarPlay.

Messages declared in the CPApplicationDelegate protocol should be sent to this object in the containing application’s application delegate. Implement CarPlayManagerDelegate in the containing application and assign an instance to the delegate property of your CarPlayManager instance.

Note

It is very important you have a single CarPlayManager instance at any given time. This should be managed by your UIApplicationDelegate class if you choose to supply your accessToken to the CarPlayManager.eventsManager via NavigationEventsManager initializer, instead of the Info.plist.
  • Calculates routes to the given destination using the Mapbox Directions API and previews them on a map.

    Upon successful calculation a new template will be pushed onto the template navigation hierarchy.

    Declaration

    Swift

    public func previewRoutes(to destination: Waypoint, completionHandler: @escaping CompletionHandler)

    Parameters

    destination

    A final destination Waypoint.

    completionHandler

    A closure to be executed when the calculation completes.

  • Allows to preview routes for a list of Waypoint objects.

    Declaration

    Swift

    public func previewRoutes(between waypoints: [Waypoint], completionHandler: @escaping CompletionHandler)

    Parameters

    waypoints

    A list of Waypoint objects.

    completionHandler

    A closure to be executed when the calculation completes.

  • Calculates routes satisfying the given options using the Mapbox Directions API and previews them on a map.

    Declaration

    Swift

    public func previewRoutes(for options: RouteOptions, completionHandler: @escaping CompletionHandler)

    Parameters

    routeOptions

    A RouteOptions object, which specifies the criteria for results returned by the Mapbox Directions API.

    completionHandler

    A closure to be executed when the calculation completes.