The Mapbox Navigation SDK is comprised of two modules:
- MapboxCoreNavigation - responsible for rerouting, snapping, progress updates etc.
- MapboxNavigation - responsible for everything UI related.
If the UI provided by MapboxNavigation is not something that can work for your project, it is possible to create a custom navigation experience built on top of MapboxCoreNavigation directly. Note, this is not ideal as it will be a lot of work for the developer. If there is something missing from the UI or not optimal, feel free to open a ticket instead of venturing down this path.
The installation process is very similar to install MapboxNavigation:
To install Mapbox Core Navigation 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:machine api.mapbox.com login mapbox password PRIVATE_MAPBOX_API_TOKEN
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', '~> 1.4' # Latest prerelease pod 'MapboxCoreNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :tag => 'v1.3.0-beta.1'
-
Run
pod repo update && pod install
and open the resulting Xcode workspace.
To install Mapbox Navigation using Carthage v0.35 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:machine api.mapbox.com login mapbox password PRIVATE_MAPBOX_API_TOKEN
where PRIVATE_MAPBOX_API_TOKEN is your Mapbox API token with the
DOWNLOADS:READ
scope. -
(Optional) Clear your Carthage caches:
rm -rf ~/Library/Caches/carthage/ ~/Library/Caches/org.carthage.CarthageKit/binaries/{MapboxAccounts,MapboxCommon-ios,MapboxNavigationNative}
-
Create a Cartfile with the following dependency:
# Latest stable release github "mapbox/mapbox-navigation-ios" ~> 1.4 # Latest prerelease github "mapbox/mapbox-navigation-ios" "v1.3.0-beta.1"
-
Run
./Carthage/Checkouts/mapbox-navigation-ios/scripts/wcarthage.sh bootstrap --platform iOS --cache-builds --use-netrc
. (wcarthage.sh is a temporary replacement forcarthage
to work around a linker error in Xcode 12.) -
Follow the rest of Carthage’s iOS integration instructions. Your application target’s Embed Frameworks build phase should include
MapboxCoreNavigation.framework
,MapboxNavigationNative.framework
,MapboxCommon.framework
, andMapboxAccounts.framework
.
To install the MapboxCoreNavigation framework using Swift Package Manager on the command line:
-
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:machine api.mapbox.com login mapbox password PRIVATE_MAPBOX_API_TOKEN
where PRIVATE_MAPBOX_API_TOKEN is your Mapbox API token with the
DOWNLOADS:READ
scope. -
Run
swift package init
to create a Package.swift, then add the following dependency:// Latest stable release .package(name: "MapboxCoreNavigation", url: "https://github.com/mapbox/mapbox-navigation-ios.git", from: "1.4.0") // Latest prerelease .package(name: "MapboxCoreNavigation", url: "https://github.com/mapbox/mapbox-navigation-ios.git", from: "1.4.0")
To install the MapboxCoreNavigation framework using Swift Package Manager within Xcode:
-
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:machine api.mapbox.com login mapbox password PRIVATE_MAPBOX_API_TOKEN
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
1.4.0
as the minimum version requirement. Click Next.