Swift Ruby Other
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.github Link to mapbox/navigation-ios-examples, add issue template (#1000) Jan 11, 2018
.tx Removed localizableabbreviations from Transifex configuration Mar 22, 2018
Examples Cleaned up encodings Mar 23, 2018
MapboxCoreNavigation Added European Portuguese localization Mar 22, 2018
MapboxCoreNavigationTests Fix user puck facing wrong direction when backwards (#1224) Mar 22, 2018
MapboxNavigation.xcodeproj Added Hebrew stringsdict Mar 22, 2018
MapboxNavigation Merge pull request #1254 from mapbox/1ec5-navigation-localizable-strings Mar 23, 2018
MapboxNavigationTests Rename redundant style types Mar 22, 2018
docs Added European Portuguese localization Mar 22, 2018
scripts Remove leftovers from client-side abbreviations Mar 20, 2018
.gitignore Inject a SpeechAPISpy under test Mar 19, 2018
.swift-version swift 4 Nov 22, 2017
.swiftlint.yml Introduce swiftlint Jan 24, 2018
CHANGELOG.md Fix custom image for annotation (#1256) Mar 23, 2018
CONTRIBUTING.md Updated link to Android l10n instructions Mar 20, 2018
Cartfile bump Mar 21, 2018
Cartfile.private Refactor for testability (#282) Jun 26, 2017
Cartfile.resolved Use release Mar 21, 2018
LICENSE.md Stick to chosen route (#995) Jan 9, 2018
MapboxCoreNavigation.podspec bump Mar 21, 2018
MapboxNavigation-Documentation.podspec bump Mar 21, 2018
MapboxNavigation.podspec remove beta Mar 12, 2018
README.md Dont need both for non beta Mar 12, 2018
custom-navigation.md remove beta Mar 12, 2018


Mapbox Navigation SDK for iOS

Build Status Carthage compatible CocoaPods

Mapbox Navigation SDK

Mapbox Navigation gives you all the tools you need to add turn-by-turn navigation to your application.

Get up and running in a few minutes with our drop-in turn-by-turn navigation NavigationViewController, or build a completely custom turn-by-turn navigation app with our core components for routing and navigation.




The Mapbox Navigation SDK and Core Navigation are compatible with applications written in Swift 4 or Objective-C in Xcode 9.0. The Mapbox Navigation framework runs on iOS 9.0 and above, while the Core Navigation framework runs on iOS 8.0 and above.

The last release compatible with Swift 3.2 was v0.10.1.

The Mapbox Navigation SDK is also available for Android.


Using CocoaPods

To install Mapbox Navigation using CocoaPods:

  1. Create a Podfile with the following specification:

    pod 'MapboxNavigation', '~> 0.15'
  2. Run pod repo update && pod install and open the resulting Xcode workspace.

Using Carthage

Alternatively, to install Mapbox Navigation using Carthage:

  1. Create a Cartfile with the following dependency:

    github "mapbox/mapbox-navigation-ios" ~> 0.15
  2. Run carthage update --platform iOS to build just the iOS dependencies.

  3. Follow the rest of Carthage’s iOS integration instructions. Your application target’s Embedded Frameworks should include MapboxNavigation.framework and MapboxCoreNavigation.framework.


  1. Mapbox APIs and vector tiles require a Mapbox account and API access token. In the project editor, select the application target, then go to the Info tab. Under the “Custom iOS Target Properties” section, set MGLMapboxAccessToken to your access token. You can obtain an access token from the Mapbox account page.

  2. In order for the SDK to track the user’s location as they move along the route, set NSLocationWhenInUseUsageDescription to:

    Shows your location on the map and helps improve OpenStreetMap.

  3. Users expect the SDK to continue to track the user’s location and deliver audible instructions even while a different application is visible or the device is locked. Go to the Capabilities tab. Under the Background Modes section, enable “Audio, AirPlay, and Picture in Picture” and “Location updates”. (Alternatively, add the audio and location values to the UIBackgroundModes array in the Info tab.)

Now import the relevant modules and present a new NavigationViewController. You can also push to a navigation view controller from within a storyboard if your application’s UI is laid out in Interface Builder.

import MapboxDirections
import MapboxCoreNavigation
import MapboxNavigation
let origin = Waypoint(coordinate: CLLocationCoordinate2D(latitude: 38.9131752, longitude: -77.0324047), name: "Mapbox")
let destination = Waypoint(coordinate: CLLocationCoordinate2D(latitude: 38.8977, longitude: -77.0365), name: "White House")

let options = NavigationRouteOptions(waypoints: [origin, destination])

Directions.shared.calculate(options) { (waypoints, routes, error) in
    guard let route = routes?.first else { return }

    let viewController = NavigationViewController(for: route)
    present(viewController, animated: true, completion: nil)

Consult the API reference for further details.


The API reference includes example code for accomplishing common tasks. You can run these examples as part of the navigation-ios-examples project.

This repository also contains Swift and Objective-C testbeds that exercise a variety of navigation SDK features:

  1. Clone the repository or download the .zip file
  2. Run carthage update --platform ios to build just the iOS dependencies.
  3. Open MapboxNavigation.xcodeproj.
  4. Sign up or log in to your Mapbox account and grab a Mapbox Access Token.
  5. Open the Info.plist for either Example-Swift or Example-Objective-C and paste your Mapbox Access Token into MGLMapboxAccessToken. (Alternatively, if you plan to use this project as the basis for a public project on GitHub, place the access token in a plain text file named .mapbox or mapbox in your home directory instead of adding it to Info.plist.)
  6. Build and run the Example-Swift or Example-Objective-C target.



You can customize the appearance in order to blend in with the rest of your app. Checkout DayStyle.swift for all styleable elements.

class CustomStyle: DayStyle {

    required init() {
        mapStyleURL = URL(string: "mapbox://styles/mapbox/satellite-streets-v9")!
        styleType = .nightStyle

    override func apply() {
        BottomBannerView.appearance().backgroundColor = .orange

then initialize NavigationViewController with your style or styles:

NavigationViewController(for: route, styles: [CustomStyle()])

NavigationViewControllerDelegate methods

  • navigationViewController:didArriveAtDestination:: Fired when the user arrives at their destination. You are responsible for dismissing the UI.
  • navigationViewControllerDidCancelNavigation: Fired when the user taps Cancel. You are responsible for dismissing the UI.
  • navigationViewController:shouldRerouteFromLocation:: Fired when SDK detects that a user has gone off route. You can return false here to either prevent a reroute from occuring or if you want to rerequest an alternative route manually.
  • navigationViewController:willRerouteFromLocation:: Fired just before the SDK requests a new route.
  • navigationViewController:didRerouteAlongRoute:: Fired as soon as the SDK receives a new route.
  • navigationViewController:didFailToRerouteWithError:: Fired when SDK receives an error instead of a new route.


RouteController is given a route. Internally RouteController matches the user's current location to the route while looking at 3 principle pieces:

  1. Is the user on or off the route?
  2. How far along the step is the user?
  3. Does the user need to be alerted about an upcoming maneuver?

The library compares the user from the route and decides upon each one of these parameters and acts accordingly. The developer is told what is happening behind the scenes via notifications.

Building your own custom navigation UI

Looking for a more advanced use case? See our installation guide of MapboxCoreNavigation.


We welcome feedback and code contributions! Please see CONTRIBUTING.md for details.


Mapbox Navigation SDK for iOS is released under the ISC License. See LICENSE.md for details.