MapboxNavigationService
public class MapboxNavigationService : NSObject, NavigationService
extension MapboxNavigationService: CLLocationManagerDelegate
extension MapboxNavigationService: RouterDelegate
A concrete implementation of the NavigationService
protocol.
NavigationViewController
comes with a MapboxNavigationService
by default. You may override it to customize the Directions
service or simulation mode. After creating the navigation service, pass it into NavigationOptions(styles:navigationService:voiceController:topBanner:bottomBanner:)
, then pass that object into NavigationViewController(for:options:)
.
If you use a navigation service by itself, outside of NavigationViewController
, call start()
when the user is ready to begin navigating along the route.
-
The Amount of time the service will wait until it begins simulation in a poor GPS scenerio. Defaults to 2.5 seconds.
Declaration
Swift
public var poorGPSPatience: Double { get set }
-
The active location manager. Returns the location simulator if we’re actively simulating, otherwise it returns the native location manager.
Declaration
Swift
public var locationManager: NavigationLocationManager { get }
-
A reference to a MapboxDirections service. Used for rerouting.
Declaration
Swift
public var directions: Directions
-
The active router. By default, a
RouteController
.Declaration
Swift
public var router: Router!
-
The events manager. Sends telemetry back to the Mapbox platform.
Declaration
Swift
public var eventsManager: NavigationEventsManager!
-
The
NavigationService
delegate. WrapsRouterDelegate
messages.Declaration
Swift
public weak var delegate: NavigationServiceDelegate?
-
The simulation mode of the service.
Declaration
Swift
public var simulationMode: SimulationMode { get set }
-
The simulation speed multiplier. If you desire the simulation to go faster than real-time, increase this value.
Declaration
Swift
public var simulationSpeedMultiplier: Double { get set }
-
init(route:routeIndex:routeOptions:directions:locationSource:eventsManagerType:simulating:routerType:)
Intializes a new
NavigationService
.Declaration
Swift
required public init(route: Route, routeIndex: Int, routeOptions: RouteOptions, directions: Directions? = nil, locationSource: NavigationLocationManager? = nil, eventsManagerType: NavigationEventsManager.Type? = nil, simulating simulationMode: SimulationMode = .onPoorGPS, routerType: Router.Type? = nil)
Parameters
route
The route to follow.
routeIndex
The index of the route within the original
RouteResponse
object.directions
The Directions object that created
route
.locationSource
An optional override for the default
NaviationLocationManager
.eventsManagerType
An optional events manager type to use while tracking the route.
simulationMode
The simulation mode desired.
routerType
An optional router type to use for traversing the route.
-
Determines if a location is within a tunnel.
Declaration
Swift
public func isInTunnel(at location: CLLocation, along progress: RouteProgress) -> Bool
Parameters
location
The location to test.
progress
the RouteProgress model that contains the route geometry.
-
Declaration
Swift
public var indexedRoute: IndexedRoute { get set }
-
Declaration
Swift
public var route: Route { get }
-
Declaration
Swift
public func start()
-
Declaration
Swift
public func stop()
-
Declaration
Swift
public func endNavigation(feedback: EndOfRouteFeedback? = nil)
-
Keys in the user info dictionaries of various notifications posted by instances of
See moreNavigationService
.Declaration
Swift
public struct NotificationUserInfoKey : Hashable, Equatable, RawRepresentable
-
Declaration
Swift
public func router(_ router: Router, willRerouteFrom location: CLLocation)
-
Declaration
-
Declaration
Swift
public func router(_ router: Router, didFailToRerouteWith error: Error)
-
Declaration
Swift
public func router(_ router: Router, didRefresh routeProgress: RouteProgress)
-
Declaration
Swift
public func router(_ router: Router, didUpdate progress: RouteProgress, with location: CLLocation, rawLocation: CLLocation)
-
Declaration
Swift
public func router(_ router: Router, didPassVisualInstructionPoint instruction: VisualInstructionBanner, routeProgress: RouteProgress)
-
Declaration
Swift
public func router(_ router: Router, didPassSpokenInstructionPoint instruction: SpokenInstruction, routeProgress: RouteProgress)
-
Declaration
Swift
public func router(_ router: Router, shouldRerouteFrom location: CLLocation) -> Bool
-
Declaration
Swift
public func router(_ router: Router, shouldDiscard location: CLLocation) -> Bool
-
Declaration
-
-
Declaration
-
Declaration
Swift
public func routerShouldDisableBatteryMonitoring(_ router: Router) -> Bool
-
Declaration
Swift
public var locationProvider: NavigationLocationManager.Type { get }