NavigationViewController
public class NavigationViewController: NavigationPulleyViewController, RouteMapViewControllerDelegate
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
public var route: Route!
-
An instance of
MGLAnnotation
that will be shown on on the destination of your route. The last coordinate of the route will be used if no destination is given.Declaration
Swift
public var destination: MGLAnnotation!
-
An instance of
Directions
need for rerouting. See Mapbox Directions for further information.Declaration
Swift
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
public var pendingCamera: MGLMapCamera?
-
An instance of
MGLAnnotation
representing the origin of your route.Declaration
Swift
public var origin: MGLAnnotation?
-
The receiver’s delegate.
Declaration
Swift
public weak var navigationDelegate: NavigationViewControllerDelegate?
-
Provides access to various speech synthesizer options.
See
RouteVoiceController
for more information.Declaration
Swift
public var voiceController: RouteVoiceController? = RouteVoiceController()
-
Provides all routing logic for the user.
See
RouteController
for more information.Declaration
Swift
public var routeController: RouteController!
-
Provides access to the navigation’s
MGLMapView
with all its styling capabilities.Note that you should not change the
mapView
‘s delegate.Declaration
Swift
public var mapView: MGLMapView?
-
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
public var snapsUserLocationAnnotationToRoute = true
-
Toggles sending of UILocalNotification upon upcoming steps when application is in the background. Defaults to
true
.Declaration
Swift
public var sendNotifications: Bool = true
-
Shows a button that allows drivers to report feedback such as accidents, closed roads, poor instructions, etc. Defaults to
false
.Declaration
Swift
public var showsReportFeedback: Bool = false
-
If true, the map style and UI will automatically be updated given the time of day.
Declaration
Swift
public var automaticallyAdjustsStyleForTimeOfDay = false
-
Declaration
Swift
required public init?(coder aDecoder: NSCoder)
Parameters
aDecoder
-
Declaration
Swift
required public init(contentViewController: UIViewController, drawerViewController: UIViewController)
Parameters
contentViewController
drawerViewController
-
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 routeController(_ routeController: RouteController, shouldRerouteFrom location: CLLocation) -> Bool
Parameters
routeController
location
-
Declaration
Swift
public func routeController(_ routeController: RouteController, willRerouteFrom location: CLLocation)
Parameters
routeController
location
-
Declaration
Swift
public func routeController(_ routeController: RouteController, didRerouteAlong route: Route)
Parameters
routeController
route
-
Declaration
Swift
public func routeController(_ routeController: RouteController, didFailToRerouteWith error: Error)
Parameters
routeController
error
-
Declaration
Swift
public func routeController(_ routeController: RouteController, didUpdate locations: [CLLocation])
Parameters
routeController
locations
-
Declaration
Swift
public func routeController(_ routeController: RouteController, didDiscard location: CLLocation)
Parameters
routeController
location