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!
-
Styles that will be used for various system traits.
See
Style
andDefaultStyle
for more information.Declaration
Swift
public var styles: [Style] = [DefaultStyle()]
-
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?
-
Toggles sending of UILocalNotification upon upcoming steps when application is in the background. Defaults to
true
.Declaration
Swift
public var sendNotifications: Bool = true
-
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]? = [DefaultStyle()], locationManager: NavigationLocationManager? = DefaultLocationManager())
-
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, didUpdateLocations locations: [CLLocation])
Parameters
routeController
locations