NavigationViewController
@objc(MBNavigationViewController)
open class NavigationViewController : UIViewController, NavigationStatusPresenter
NavigationViewController
is a fully-featured turn-by-turn navigation UI.
It provides step by step instructions, an overview of all steps for the given route and support for basic styling.
Seealso
CarPlayNavigationViewController-
A
Route
object constructed by MapboxDirections.In cases where you need to update the route after navigation has started you can set a new
route
here andNavigationViewController
will update its UI accordingly.Declaration
Swift
@objc public var route: Route { get set }
-
An instance of
Directions
need for rerouting. See Mapbox Directions for further information.Declaration
Swift
@objc public var directions: Directions { get }
-
An optional
MGLMapCamera
you can use to improve the initial transition from a previous viewport and prevent a trigger from an excessive significant location update.Declaration
Swift
@objc public var pendingCamera: MGLMapCamera?
-
An instance of
MGLAnnotation
representing the origin of your route.Declaration
Swift
@objc public var origin: MGLAnnotation?
-
The receiver’s delegate.
Declaration
Swift
@objc public weak var delegate: NavigationViewControllerDelegate?
-
Provides access to various speech synthesizer options.
See
RouteVoiceController
for more information.Declaration
Swift
@objc public var voiceController: RouteVoiceController!
-
Provides all routing logic for the user.
See
NavigationService
for more information.Declaration
Swift
@objc private(set) public var navigationService: NavigationService! { get set }
-
The main map view displayed inside the view controller.
Note
Do not change this map view’sNavigationMapView.navigationMapDelegate
property; instead, implement the corresponding methods onNavigationViewControllerDelegate
.Declaration
Swift
@objc public var mapView: NavigationMapView? { get }
-
Determines whether the user location annotation is moved from the raw user location reported by the device to the nearest location along the route.
By default, this property is set to
true
, causing the user location annotation to be snapped to the route.Declaration
Swift
@objc public var snapsUserLocationAnnotationToRoute: Bool
-
Toggles sending of UILocalNotification upon upcoming steps when application is in the background. Defaults to
true
.Declaration
Swift
@objc public var sendsNotifications: Bool
-
Shows a button that allows drivers to report feedback such as accidents, closed roads, poor instructions, etc. Defaults to
true
.Declaration
Swift
@objc public var showsReportFeedback: Bool { get set }
-
Shows End of route Feedback UI when the route controller arrives at the final destination. Defaults to
true.
Declaration
Swift
@objc public var showsEndOfRouteFeedback: Bool { get set }
-
If true, the map style and UI will automatically be updated given the time of day.
Declaration
Swift
@objc public var automaticallyAdjustsStyleForTimeOfDay: Bool { get set }
-
If
true
,UIApplication.isIdleTimerDisabled
is set totrue
inviewWillAppear(_:)
andfalse
inviewWillDisappear(_:)
. If your application manages the idle timer itself, set this property tofalse
.Declaration
Swift
@objc public var shouldManageApplicationIdleTimer: Bool
-
A Boolean value that determines whether the map annotates the locations at which instructions are spoken for debugging purposes.
Declaration
Swift
@objc public var annotatesSpokenInstructions: Bool
-
Initializes a
NavigationViewController
that provides turn by turn navigation for the given route. A optionaldirection
object is needed for potential rerouting.See Mapbox Directions for further information.
Declaration
Swift
@objc(initWithRoute:options:) required public init(for route: Route, options: NavigationOptions? = nil)
Parameters
route
The route to navigate along.
options
The navigation options to use for the navigation session. See
NavigationOptions
.
-
Declaration
Swift
public func showStatus(title: String, spinner: Bool, duration: TimeInterval, animated: Bool, interactive: Bool)
-
Declaration
Swift
public func navigationMapView(_ mapView: NavigationMapView, routeCasingStyleLayerWithIdentifier identifier: String, source: MGLSource) -> MGLStyleLayer?
-
Declaration
Swift
public func navigationMapView(_ mapView: NavigationMapView, routeStyleLayerWithIdentifier identifier: String, source: MGLSource) -> MGLStyleLayer?
-
Declaration
Swift
public func navigationMapView(_ mapView: NavigationMapView, didSelect route: Route)
-
Declaration
Swift
@objc public func navigationMapView(_ mapView: NavigationMapView, shapeFor routes: [Route]) -> MGLShape?
-
Declaration
Swift
@objc public func navigationMapView(_ mapView: NavigationMapView, simplifiedShapeFor route: Route) -> MGLShape?
-
Declaration
Swift
public func navigationMapView(_ mapView: NavigationMapView, waypointStyleLayerWithIdentifier identifier: String, source: MGLSource) -> MGLStyleLayer?
-
Declaration
Swift
public func navigationMapView(_ mapView: NavigationMapView, waypointSymbolStyleLayerWithIdentifier identifier: String, source: MGLSource) -> MGLStyleLayer?
-
Declaration
Swift
@objc public func navigationMapView(_ mapView: NavigationMapView, shapeFor waypoints: [Waypoint], legIndex: Int) -> MGLShape?
-
Declaration
Swift
public func navigationMapViewUserAnchorPoint(_ mapView: NavigationMapView) -> CGPoint
-
Declaration
Swift
@objc public func label(_ label: InstructionLabel, willPresent instruction: VisualInstruction, as presented: NSAttributedString) -> NSAttributedString?
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, shouldRerouteFrom location: CLLocation) -> Bool
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, willRerouteFrom location: CLLocation)
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, didRerouteAlong route: Route, at location: CLLocation?, proactive: Bool)
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, didFailToRerouteWith error: Error)
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, shouldDiscard location: CLLocation) -> Bool
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, didUpdate progress: RouteProgress, with location: CLLocation, rawLocation: CLLocation)
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, didPassSpokenInstructionPoint instruction: SpokenInstruction, routeProgress: RouteProgress)
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, didPassVisualInstructionPoint instruction: VisualInstructionBanner, routeProgress: RouteProgress)
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, willArriveAt waypoint: Waypoint, after remainingTimeInterval: TimeInterval, distance: CLLocationDistance)
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, didArriveAt waypoint: Waypoint) -> Bool
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, willBeginSimulating progress: RouteProgress, becauseOf reason: SimulationIntent)
-
Declaration
Swift
public func navigationService(_ service: NavigationService, didBeginSimulating progress: RouteProgress, becauseOf reason: SimulationIntent)
-
Declaration
Swift
@objc public func navigationService(_ service: NavigationService, willEndSimulating progress: RouteProgress, becauseOf reason: SimulationIntent)
-
Declaration
Swift
public func navigationService(_ service: NavigationService, didEndSimulating progress: RouteProgress, becauseOf reason: SimulationIntent)
-
Declaration
Swift
public func navigationService(_ service: NavigationService, shouldPreventReroutesWhenArrivingAt waypoint: Waypoint) -> Bool
-
Declaration
Swift
public func navigationServiceShouldDisableBatteryMonitoring(_ service: NavigationService) -> Bool
-
Declaration
Swift
@objc(locationForStyleManager:) public func location(for styleManager: StyleManager) -> CLLocation?
-
Declaration
Swift
@objc(styleManager:didApplyStyle:) public func styleManager(_ styleManager: StyleManager, didApply style: Style)
-
Declaration
Swift
@objc public func styleManagerDidRefreshAppearance(_ styleManager: StyleManager)
-
Declaration
Swift
public func didTapCancel(_ sender: Any)
-
Declaration
Swift
public func didConnectToCarPlay()
-
Declaration
Swift
public func didDisconnectFromCarPlay()