NavigationViewControlleris a fully-featured user interface for turn-by-turn navigation. Do not confuse it with the
NavigationControllerclass in UIKit.
You initialize a navigation view controller based on a predefined
NavigationOptions. As the user progresses along the route, the navigation view controller shows their surroundings and the route line on a map. Banners above and below the map display key information pertaining to the route. A list of steps and a feedback mechanism are accessible via the navigation view controller.
Route initialization should be configured before view controller’s
viewis loaded. Usually, that is automatically done during any of the
inits, but you may also change this settings via
prepareViewLoading(routeResponse:, routeIndex:, routeOptions:, navigationOptions:)methods. For example that could be handy while configuring a ViewController for a
To be informed of significant events and decision points as the user progresses along the route, set the
NavigationService.delegateproperty of the
NavigationServicethat you provide when creating the navigation options.
CarPlayNavigationViewControllermanages the corresponding user interface on a CarPlay screen.
ImportantCreating an instance of this type with parameters that uses
RouteControllerwith will start an Active Guidance session. The trip session is stopped when the instance is deallocated. For more info read the Pricing Guide.
open class NavigationViewController : UIViewController, NavigationStatusPresenter, NavigationViewData, BuildingHighlighting
extension NavigationViewController: NavigationServiceDelegate
extension NavigationViewController: StyleManagerDelegate
extension NavigationViewController: TopBannerViewControllerDelegate
extension NavigationViewController: BottomBannerViewControllerDelegate
extension NavigationViewController: CarPlayConnectionObserver
extension NavigationViewController: NavigationMapViewDelegate
NavigationViewControllerDelegateprotocol provides methods for configuring the map view shown by a
NavigationViewControllerand responding to the cancellation of a navigation session.
For convenience, several location-related methods in theSee more
NavigationServiceDelegateprotocol have corresponding methods in this protocol.
public protocol NavigationViewControllerDelegate : VisualInstructionDelegate
A route voice controller monitors turn-by-turn navigation events and triggers playing spoken instructions as audio using the Speech Synthesis framework, also known as VoiceOver.
You initialize a voice controller using a
NavigationServiceinstance. The voice controller observes when the navigation service hints that the user has passed a spoken instruction point and responds by calling it’s
speechSynthesizerto handle the vocalization.
You can also subclassSee more
RouteVoiceControllerto implement you own mechanism of monitoring navgiation events and calling
open class RouteVoiceController : NSObject, AVSpeechSynthesizerDelegate
SpeechSynthesizingimplementation, aggregating other implementations, to allow ‘fallback’ mechanism. Can be initialized with array of synthesizers which will be called in order of appearance, until one of them is capable to vocalize current
Customization options for the turn-by-turn navigation user experience in a
A navigation options object is where you place customized components that the navigation view controller uses during its lifetime, such as styles or voice controllers. You would likely use this class if you need to specify a Mapbox access token programmatically instead of in the Info.plist file.
NavigationOptionsis designed to be used with the
NavigationViewControllerclass to customize the user experience. To specify criteria when calculating routes, use the
NavigationRouteOptionsclass. To modify user preferences that persist across navigation sessions, use the
open class NavigationOptions : NavigationCustomizable
A view that represents the root view of the MapboxNavigation drop-in UI.
+--------------------+ | 1 | +--------------------+ | 2 | +---+------------+---+ | 8 | | | +---+ | 6 | | | | | 7 +---+ | | | | | | +------------+ | | 4 || 5 | | +------------+-------+ | 3 | +--------------------+
@IBDesignable open class NavigationView : UIView