• 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 Route 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.

    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.

    See more

    Declaration

    Swift

    open class NavigationViewController : UIViewController, NavigationStatusPresenter
    extension NavigationViewController: NavigationServiceDelegate
    extension NavigationViewController: StyleManagerDelegate
    extension NavigationViewController: TopBannerViewControllerDelegate
    extension NavigationViewController: BottomBannerViewControllerDelegate
    extension NavigationViewController: CarPlayConnectionObserver
  • 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 plays 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 reading aloud the contents of a SpokenInstruction object using an AVSpeechSynthesizer object.

    The Speech Synthesis framework does not require a network connection, but the speech quality may be limited in some languages including English. By default, a NavigationViewController plays spoken instruction susing a subclass, MapboxVoiceController, that is powered by the MapboxSpeech framework instead of the Speech Synthesis framework.

    If you need to supply a third-party speech synthesizer, define a subclass of RouteVoiceController that overrides the speak(_:) method. If the third-party speech synthesizer requires a network connection, you can instead subclass MapboxVoiceController to take advantage of its prefetching functionality.

    See more

    Declaration

    Swift

    open class RouteVoiceController : NSObject, AVSpeechSynthesizerDelegate
  • The VoiceControllerDelegate protocol defines methods that allow an object to respond to significant events related to spoken instructions.

    See more

    Declaration

    Swift

    public protocol VoiceControllerDelegate : AnyObject, UnimplementedLogging
  • The Mapbox voice controller plays spoken instructions using the MapboxSpeech framework.

    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 converting the contents of a SpokenInstruction object into audio and playing the audio.

    The MapboxSpeech framework requires a network connection to connect to the Mapbox Voice API, but it produces superior speech output in several languages including English. If the voice controller is unable to connect to the Voice API, it falls back to the Speech Synthesis framework as implemented by the superclass, RouteVoiceController. To mitigate network latency over a cell connection, MapboxVoiceController prefetches and caches synthesized audio.

    If you need to supply a third-party speech synthesizer that requires a network connection, define a subclass of MapboxVoiceController that overrides the speak(_:) method. If the third-party speech synthesizer does not require a network connection, you can instead subclass RouteVoiceController.

    The Mapbox Voice API is optimized for spoken instructions provided by the Mapbox Directions API via the MapboxDirections.swift framework. If you need text-to-speech functionality outside the context of a navigation service, use the Speech Synthesis framework’s AVSpeechSynthesizer class directly.

    See more

    Declaration

    Swift

    open class MapboxVoiceController : RouteVoiceController, AVAudioPlayerDelegate
  • 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