All docsHelpTutorialsVideo: Build a navigation app for iOS

Video: Build a navigation app for iOS

Advanced
Swift
Prerequisite

Familiarity with Xcode and Swift

The Mapbox Navigation SDK for iOS gives you all the tools you need to add turn-by-turn navigation to your iOS app. You can get up and running in a few minutes with our drop-in navigation view controller, or build a completely custom app with our core components for routing and navigation.

In this video, we'll show you how to install the Navigation SDK, import it into an iOS app, request directions between two predefined waypoints, and show the navigation UI using simulated real-time location in Xcode.

Getting started

Install the Navigation SDK

  • 0:22 - Create a new access token with DOWNLOADS/READ private scope
  • 0:37 - Create a .netrc file using the new access token and save it in your user directory
  • 2:27 - Create a new Xcode project
  • 3:12 - Create a new access token with public scopes
  • 4:15 - Add the public access token to your project's info.plist
  • 4:46 - Install the Navigation SDK from source (via GitHub)

Add a map and display a route

  • 6:55 - Import MapboxMaps and add a MapView to the main view controller
  • 8:15 - Import MapboxDirections, configure RouteOptions
  • 9:45 - Request a route from the Mapbox Directions API
  • 10:55 - Import MapboxNavigation and use a NavigationMapView and showcase() to display the route

Add live turn-by-turn navigation

  • 14:02 - Create a NavigationViewController
  • 15:38 - Add NSLocationWhenInUseUsageDescription to Info.plist (see our suggested language)
  • 16:47 - Add the Audio, Airplay, and Picture in Picture background mode to your app
  • 18:08 - See the Navigation in action using the iOS Simulator's location simulation (set to 'Freeway Drive')

Next steps

There are many other ways you can customize the Mapbox Navigation SDK for iOS beyond what you've done in this tutorial. For a complete reference of customization options see the Navigation SDK for iOS documentation. Options include: