• NavigationViewController is a fully-featured user interface for turn-by-turn navigation. Do not confuse it with the NavigationController class in UIKit.

    You initialize a navigation view controller based on a predefined RouteResponse and 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 view is 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 UIStoryboardSegue.

    To be informed of significant events and decision points as the user progresses along the route, set the NavigationService.delegate property of the NavigationService that you provide when creating the navigation options.

    CarPlayNavigationViewController manages the corresponding user interface on a CarPlay screen.

    Important

    Creating an instance of this type with parameters that uses RouteController with will start an Active Guidance session. The trip session is stopped when the instance is deallocated. For more info read the Pricing Guide.
    See more

    Declaration

    Swift

    open class NavigationViewController : UIViewController, NavigationStatusPresenter, NavigationViewData
    extension NavigationViewController: NavigationServiceDelegate
    extension NavigationViewController: StyleManagerDelegate
    extension NavigationViewController: TopBannerViewControllerDelegate
    extension NavigationViewController: BottomBannerViewControllerDelegate
    extension NavigationViewController: CarPlayConnectionObserver
    extension NavigationViewController: NavigationMapViewDelegate
  • The NavigationViewControllerDelegate protocol provides methods for configuring the map view shown by a NavigationViewController and responding to the cancellation of a navigation session.

    For convenience, several location-related methods in the NavigationServiceDelegate protocol have corresponding methods in this protocol.

    See more

    Declaration

    Swift

    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 NavigationService instance. The voice controller observes when the navigation service hints that the user has passed a spoken instruction point and responds by calling it’s speechSynthesizer to handle the vocalization.

    If you want to use your own custom SpeechSynthesizing implementation - also pass it during initialization. If no implementation is provided - MultiplexedSpeechSynthesizer will be used by default.

    You can also subclass RouteVoiceController to implement you own mechanism of monitoring navgiation events and calling speechSynthesizer.

    See more

    Declaration

    Swift

    open class RouteVoiceController : NSObject, AVSpeechSynthesizerDelegate
  • Protocol for implementing speech synthesizer to be used in RouteVoiceController.

    See more

    Declaration

    Swift

    public protocol SpeechSynthesizing : AnyObject
  • The SpeechSynthesizingDelegate protocol defines methods that allow an object to respond to significant events related to spoken instructions.

    See more

    Declaration

    Swift

    public protocol SpeechSynthesizingDelegate : AnyObject, UnimplementedLogging
  • SpeechSynthesizing implementation, using MapboxSpeech framework. Uses pre-caching mechanism for upcoming instructions.

    See more

    Declaration

    Swift

    open class MapboxSpeechSynthesizer : NSObject, SpeechSynthesizing
    extension MapboxSpeechSynthesizer: AVAudioPlayerDelegate
  • SpeechSynthesizing implementation, using AVSpeechSynthesizer.

    See more

    Declaration

    Swift

    open class SystemSpeechSynthesizer : NSObject, SpeechSynthesizing
    extension SystemSpeechSynthesizer: 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 SpokenInstruction

    See more

    Declaration

    Swift

    open class MultiplexedSpeechSynthesizer : SpeechSynthesizing
    extension MultiplexedSpeechSynthesizer: SpeechSynthesizingDelegate
  • A error type returned when encountering errors in the speech engine.

    See more

    Declaration

    Swift

    public enum SpeechError : LocalizedError
  • The speech-related action that failed.

    Seealso

    SpeechError
    See more

    Declaration

    Swift

    public enum SpeechFailureAction : String
  • Customization options for the turn-by-turn navigation user experience in a NavigationViewController.

    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.

    Note

    NavigationOptions is designed to be used with the NavigationViewController class to customize the user experience. To specify criteria when calculating routes, use the NavigationRouteOptions class. To modify user preferences that persist across navigation sessions, use the NavigationSettings class.
    See more

    Declaration

    Swift

    open class NavigationOptions : NavigationCustomizable
  • A view that represents the root view of the MapboxNavigation drop-in UI.

    Components

    1. InstructionsBannerView
    2. InformationStackView
    3. BottomBannerView
    4. ResumeButton
    5. WayNameLabel
    6. FloatingStackView
    7. NavigationMapView
    8. SpeedLimitView
    +--------------------+
    |         1          |
    +--------------------+
    |         2          |
    +---+------------+---+
    | 8 |            |   |
    +---+            | 6 |
    |                |   |
    |         7      +---+
    |                    |
    |                    |
    |                    |
    +------------+       |
    |  4  ||  5  |       |
    +------------+-------+
    |         3          |
    +--------------------+
    

    Declaration

    Swift

    @IBDesignable
    open class NavigationView : UIView