The following protocols are available globally.
EventsManagerDataSourceprotocol declares values required for recording route following events.
@objc public protocol EventsManagerDataSource : AnyObject
A navigation service delegate interacts with one or more
NavigationServiceinstances (such as
MapboxNavigationServiceobjects) during turn-by-turn navigation. This protocol is the main way that your application can synchronize its state with the SDK’s location-related functionality. Each of the protocol’s methods is optional.
As the user progresses along a route, a navigation service informs its delegate about significant events as they occur, and the delegate has opportunities to influence the route and its presentation. For example, when the navigation service reports that the user has arrived at the destination, your delegate implementation could present information about the destination. It could also customize individual visual or spoken instructions along the route by returning modified instruction objects.
NavigationServiceDelegateinstance to the
NavigationService.delegateproperty of the navigation service before you start the service.
RouterDelegateprotocol defines corresponding methods so that a
Routerinstance can interact with an object that is both a router delegate and a navigation service, which in turn interacts with a navigation service delegate. Additionally, several location-related methods in this protocol have corresponding methods in the
NavigationViewControllerDelegateprotocol, which can be convenient if you are using the navigation service in conjunction with a
NavigationViewController. Normally, you would either implement methods in
@objc public protocol NavigationServiceDelegate
A router data source, also known as a location manager, supplies location data to aSee more
Routerinstance. For example, a
MapboxNavigationServicesupplies location data to a
@objc(MBRouterDataSource) public protocol RouterDataSource
A class conforming to the
Routerprotocol tracks the user’s progress as they travel along a predetermined route. It calls methods on its
delegate, which conforms to the
RouterDelegateprotocol, whenever significant events or decision points occur along the route. Despite its name, this protocol does not define the interface of a routing engine.
There are two concrete implementations of theSee more
RouteController, the default implementation, is capable of client-side routing and depends on the Mapbox Navigation Native framework.
LegacyRouteControlleris an alternative implementation that does not have this dependency but must be used in conjunction with the Mapbox Directions API over a network connection.
@objc public protocol Router : AnyObject, CLLocationManagerDelegate
A router delegate interacts with one or more
Routerinstances, such as
RouteControllerobjects, during turn-by-turn navigation. This protocol is similar to
NavigationServiceDelegate, which is the main way that your application can synchronize its state with the SDK’s location-related functionality. Normally, you should not need to make a class conform to the
RouterDelegateprotocol or call any of its methods directly, but you would need to call this protocol’s methods if you implement a custom
MapboxNavigationServiceis the only concrete implementation of a router delegate. Implement the
NavigationServiceDelegateprotocol instead to be notified when various significant events occur along the route tracked by a
@objc(MBRouterDelegate) public protocol RouterDelegate : AnyObject
A cache consists of both in-memory and on-disk components, both of which can be reset.
@objc(MBBimodalCache) public protocol BimodalCache
InstructionsCardContainerViewDelegateprotocol defines a method that allows an object to customize presented visual instructions within the instructions container view.
@objc(MBInstructionsCardContainerViewDelegate) public protocol InstructionsCardContainerViewDelegate : VisualInstructionDelegate