Skip to main content
Follow these instructions for integrating navigation in iOS app with mapbox navigation. Your podfile should look like the following. Follow cocoapods documentation for installing pods.

Usage examples

Go to project target -> Signing & Capabilities, add the following Background Modes from Capability
  1. Audio, Airplay, and Picture in Picture
  2. Location updates

Map and navigation delegates

Add a delegate method MGLMapViewDelegate, NavigationMapViewDelegate and NavigationViewControllerDelegate. And initialize router, service and mapstyle.

Requesting a baato route

We have to parse directionRoute for mapbox navigation with the help of ResType and RouteResDecoder class. Create a copy of the following classes

ResType.swift

RouteResDecoder.swift

Request a route and decode with above decoder

Starting navigation

Create and assign parameter to navigationviewcontroller
App will crash so unlock MapboxDirections package DirectionCredentials.swift and replace initializer as
Also unlock MaboxCoreNavigation package NavigationSetting.swift so, that the metric system is always taken
After that rebuild the project and run, the navigation will start.

Re-routing

Override shouldReroute from NavigationViewControllerDelegate