Mapbox Navigation gives you all the tools you need to add turn-by-turn navigation to your iOS 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.
Features
A full-fledged turn-by-turn navigation UI for iPhone, iPad, and CarPlay that’s ready to drop into your application
The Mapbox Navigation SDK and Core Navigation are compatible with applications written in Swift 5.5 in Xcode 13.1 and above. The Mapbox Navigation and Mapbox Core Navigation frameworks run on iOS 12.0 and above.
The Mapbox Navigation SDK is also available for Android.
Installation
Using Swift Package Manager
To install the MapboxNavigation framework in an application using Swift Package Manager:
Go to your Mapbox account dashboard and create an access token that has the DOWNLOADS:READ scope. PLEASE NOTE: This is not the same as your production Mapbox API token. Make sure to keep it private and do not insert it into any Info.plist file. Create a file named .netrc in your home directory if it doesn’t already exist, then add the following lines to the end of the file:
where PRIVATE_MAPBOX_API_TOKEN is your Mapbox API token with the DOWNLOADS:READ scope.
In Xcode, go to File ‣ Swift Packages ‣ Add Package Dependency.
Enter https://github.com/mapbox/mapbox-navigation-ios.git as the package repository and click Next.
Set Rules to Version, Up to Next Major, and enter 2.13.0 as the minimum version requirement. Click Next.
To install the MapboxNavigation framework in another package rather than an application, run swift package init to create a Package.swift, then add the following dependency:
To install the MapboxNavigation framework using CocoaPods:
Go to your Mapbox account dashboard and create an access token that has the DOWNLOADS:READ scope. PLEASE NOTE: This is not the same as your production Mapbox API token. Make sure to keep it private and do not insert it into any Info.plist file. Create a file named .netrc in your home directory if it doesn’t already exist, then add the following lines to the end of the file:
where PRIVATE_MAPBOX_API_TOKEN is your Mapbox API token with the DOWNLOADS:READ scope.
Create a Podfile with the following specification:
# Latest stable release
pod 'MapboxCoreNavigation', '~> 2.13'
pod 'MapboxNavigation', '~> 2.13'
# Latest prerelease
pod 'MapboxCoreNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :tag => 'v2.14.0-beta.1'
pod 'MapboxNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :tag => 'v2.14.0-beta.1'
Run pod repo update && pod install and open the resulting Xcode workspace.
Using Carthage
To install the MapboxNavigation framework using Carthage v0.38 or above:
Go to your Mapbox account dashboard and create an access token that has the DOWNLOADS:READ scope. PLEASE NOTE: This is not the same as your production Mapbox API token. Make sure to keep it private and do not insert it into any Info.plist file. Create a file named .netrc in your home directory if it doesn’t already exist, then add the following lines to the end of the file:
Run carthage bootstrap --platform iOS --use-xcframeworks --cache-builds --use-netrc.
Follow the rest of Carthage’s iOS integration instructions. Your application target’s Embed Frameworks build phase should include MapboxCoreNavigation.xcframework, MapboxNavigationNative.xcframework, and MapboxCommon.xcframework.
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 MBXAccessToken to your access token. You can obtain an access token from the Mapbox account page.
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 the map.
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 Signing & 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.)
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 a testbed application that exercises a variety of navigation SDK features. See the contributing guide for instructions on installing and running this application.
Customization
Styling
You can customize the appearance in order to blend in with the rest of your app. Checkout DayStyle.swift for all styleable elements.
If your application needs something totally custom, such as a voice-only experience or an unconventional user interface, consult the Core Navigation installation guide.
Contributing
We welcome feedback and code contributions! Please see CONTRIBUTING.md for details.
License
The Mapbox Navigation SDK for iOS is released under the Mapbox Terms of Service. See LICENSE.md for details.
Mapbox Navigation SDK for iOS
Mapbox Navigation gives you all the tools you need to add turn-by-turn navigation to your iOS 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.Features
Documentation
Requirements
The Mapbox Navigation SDK and Core Navigation are compatible with applications written in Swift 5.5 in Xcode 13.1 and above. The Mapbox Navigation and Mapbox Core Navigation frameworks run on iOS 12.0 and above.
The Mapbox Navigation SDK is also available for Android.
Installation
Using Swift Package Manager
To install the MapboxNavigation framework in an application using Swift Package Manager:
Go to your Mapbox account dashboard and create an access token that has the
DOWNLOADS:READ
scope. PLEASE NOTE: This is not the same as your production Mapbox API token. Make sure to keep it private and do not insert it into any Info.plist file. Create a file named.netrc
in your home directory if it doesn’t already exist, then add the following lines to the end of the file:where PRIVATE_MAPBOX_API_TOKEN is your Mapbox API token with the
DOWNLOADS:READ
scope.In Xcode, go to File ‣ Swift Packages ‣ Add Package Dependency.
Enter
https://github.com/mapbox/mapbox-navigation-ios.git
as the package repository and click Next.Set Rules to Version, Up to Next Major, and enter
2.13.0
as the minimum version requirement. Click Next.To install the MapboxNavigation framework in another package rather than an application, run
swift package init
to create a Package.swift, then add the following dependency:Using CocoaPods
To install the MapboxNavigation framework using CocoaPods:
Go to your Mapbox account dashboard and create an access token that has the
DOWNLOADS:READ
scope. PLEASE NOTE: This is not the same as your production Mapbox API token. Make sure to keep it private and do not insert it into any Info.plist file. Create a file named.netrc
in your home directory if it doesn’t already exist, then add the following lines to the end of the file:where PRIVATE_MAPBOX_API_TOKEN is your Mapbox API token with the
DOWNLOADS:READ
scope.Create a Podfile with the following specification:
Run
pod repo update && pod install
and open the resulting Xcode workspace.Using Carthage
To install the MapboxNavigation framework using Carthage v0.38 or above:
Go to your Mapbox account dashboard and create an access token that has the
DOWNLOADS:READ
scope. PLEASE NOTE: This is not the same as your production Mapbox API token. Make sure to keep it private and do not insert it into any Info.plist file. Create a file named.netrc
in your home directory if it doesn’t already exist, then add the following lines to the end of the file:where PRIVATE_MAPBOX_API_TOKEN is your Mapbox API token with the
DOWNLOADS:READ
scope.(Optional) Clear your Carthage caches:
Create a Cartfile with the following dependency:
Run
carthage bootstrap --platform iOS --use-xcframeworks --cache-builds --use-netrc
.Follow the rest of Carthage’s iOS integration instructions. Your application target’s Embed Frameworks build phase should include
MapboxCoreNavigation.xcframework
,MapboxNavigationNative.xcframework
, andMapboxCommon.xcframework
.MapboxNavigation no longer supports Carthage as of v2.0.0-alpha.1. However, if you are building a user interface from scratch, you can install just the MapboxCoreNavigation framework using Carthage.
Configuration
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
MBXAccessToken
to your access token. You can obtain an access token from the Mapbox account page.In order for the SDK to track the user’s location as they move along the route, set
NSLocationWhenInUseUsageDescription
to: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 Signing & Capabilities tab. Under the Background Modes section, enable “Audio, AirPlay, and Picture in Picture” and “Location updates”. (Alternatively, add the
audio
andlocation
values to theUIBackgroundModes
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.Consult the API reference for further details.
Examples
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 a testbed application that exercises a variety of navigation SDK features. See the contributing guide for instructions on installing and running this application.
Customization
Styling
You can customize the appearance in order to blend in with the rest of your app. Checkout
DayStyle.swift
for all styleable elements.then initialize
NavigationViewController
with your style or styles:Starting from scratch
If your application needs something totally custom, such as a voice-only experience or an unconventional user interface, consult the Core Navigation installation guide.
Contributing
We welcome feedback and code contributions! Please see CONTRIBUTING.md for details.
License
The Mapbox Navigation SDK for iOS is released under the Mapbox Terms of Service. See LICENSE.md for details.