NavigationViewController
open class NavigationViewController: UIViewController
NavigationViewController
is 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.
-
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!
-
An instance of
Directions
need for rerouting. See Mapbox Directions for further information.Declaration
Swift
@objc public var directions: Directions!
-
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 lazy var voiceController: RouteVoiceController? = MapboxVoiceController()
-
Provides all routing logic for the user.
See
RouteController
for more information.Declaration
Swift
@objc public var routeController: RouteController!
-
The main map view displayed inside the view controller.
Note
Do not change this map view’s delegate.Declaration
Swift
@objc public var mapView: NavigationMapView?
-
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 = true
-
Toggles sending of UILocalNotification upon upcoming steps when application is in the background. Defaults to
true
.Declaration
Swift
@objc public var sendsNotifications: Bool = true
-
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 = true
-
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 = true
-
If true, the map style and UI will automatically be updated given the time of day.
Declaration
Swift
@objc public var automaticallyAdjustsStyleForTimeOfDay = true
-
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 = false
-
A Boolean value that indicates whether the dark style should apply when a route controller enters a tunnel.
Declaration
Swift
@objc public var usesNightStyleInsideTunnels: Bool = true
-
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
required public init(for route: Route, directions: Directions = Directions.shared, styles: [Style]? = [DayStyle(), NightStyle()], locationManager: NavigationLocationManager? = NavigationLocationManager())
-
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
@objc public func navigationMapView(_ mapView: MGLMapView, imageFor annotation: MGLAnnotation) -> MGLAnnotationImage?
-
Declaration
Swift
@objc public func navigationMapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView?
-
Declaration
Swift
public func navigationMapViewUserAnchorPoint(_ mapView: NavigationMapView) -> CGPoint
-
Declaration
Swift
@objc public func routeController(_ routeController: RouteController, shouldRerouteFrom location: CLLocation) -> Bool
-
Declaration
Swift
@objc public func routeController(_ routeController: RouteController, willRerouteFrom location: CLLocation)
-
Declaration
Swift
@objc public func routeController(_ routeController: RouteController, didRerouteAlong route: Route)
-
Declaration
Swift
@objc public func routeController(_ routeController: RouteController, didFailToRerouteWith error: Error)
-
Declaration
Swift
@objc public func routeController(_ routeController: RouteController, shouldDiscard location: CLLocation) -> Bool
-
Declaration
Swift
@objc public func routeController(_ routeController: RouteController, didUpdate locations: [CLLocation])
-
Declaration
Swift
@objc public func routeController(_ routeController: RouteController, didArriveAt waypoint: Waypoint) -> Bool
-
Declaration
Swift
public func locationFor(styleManager: StyleManager) -> CLLocation
-
Declaration
Swift
public func styleManager(_ styleManager: StyleManager, didApply style: Style)
-
Declaration
Swift
public func styleManagerDidRefreshAppearance(_ styleManager: StyleManager)