Mapbox Navigation SDK for iOS
The Mapbox Navigation SDK gives you all the tools you need to add turn-by-turn navigation to your application. It takes just a few minutes to drop a full-fledged turn-by-turn navigation view controller into your application. Or use the Core Navigation framework directly to build something truly custom.
The Mapbox Navigation SDK and Core Navigation are compatible with applications written in Swift 5 in Xcode 10.2. The Mapbox Navigation and Mapbox Core Navigation frameworks run on iOS 10.0 and above.
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: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
2.0.0-rc.1
as the minimum version requirement. Click Next.
To install the MapboxCoreNavigation framework in another package rather than an application, run swift package init
to create a Package.swift, then add the following dependency:
// Latest prerelease
.package(name: "MapboxNavigation", url: "https://github.com/mapbox/mapbox-navigation-ios.git", from: "2.0.0-rc.1")
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: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 'MapboxNavigation', '~> 2.0' # Latest prerelease pod 'MapboxCoreNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :tag => 'v2.0.0-rc.1' pod 'MapboxNavigation', :git => 'https://github.com/mapbox/mapbox-navigation-ios.git', :tag => 'v2.0.0-rc.1'
Run
pod repo update && pod install
and open the resulting Xcode workspace.
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. Usage of Mapbox APIs is billed together based on monthly active users (MAU) rather than individually by HTTP request.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
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.
import MapboxDirections
import MapboxCoreNavigation
import MapboxNavigation
// Define two waypoints to travel between
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")
// Set options
let routeOptions = NavigationRouteOptions(waypoints: [origin, destination])
// Request a route using MapboxDirections
Directions.shared.calculate(routeOptions) { [weak self] (session, result) in
switch result {
case .failure(let error):
print(error.localizedDescription)
case .success(let response):
guard let strongSelf = self else {
return
}
// Pass the generated route response to the the NavigationViewController
let viewController = NavigationViewController(for: response, routeIndex: 0, routeOptions: routeOptions)
viewController.modalPresentationStyle = .fullScreen
strongSelf.present(viewController, animated: true, completion: nil)
}
}
Starting points
This SDK is divided into two frameworks: the Mapbox Navigation framework (MapboxNavigation
) is the ready-made turn-by-turn navigation UI, while the Mapbox Core Navigation framework (MapboxCoreNavigation
) is responsible for the underlying navigation logic.
Mapbox Navigation
NavigationViewController
is the main class that encapsulates the entirety of the turn-by-turn navigation UI, orchestrating the map view, various UI elements, and the route controller. Your application would most likely present an instance of this class. The NavigationViewControllerDelegate
protocol allows your application to customize various aspects of the UI and react to location-related events as they occur.
NavigationMapView
is the map view at the center of the turn-by-turn navigation UI. You can also use this class independently of NavigationViewController
, for example to display a route preview map. The NavigationMapViewDelegate
protocol allows your application to customize various aspects of the map view’s appearance. PassiveLocationProvider
is an optional alternative to CLLocationManager
for use with any standalone MapView
or NavigationMapView
.
CarPlayManager
is the class that manages the CarPlay screen if your application is CarPlay-enabled. It provides a main map for browsing, a search interface that can be powered by the Mapbox Search SDK for iOS or MapboxGeocoder.swift, and a turn-by-turn navigation UI similar to the one provided by NavigationViewController
. Your UIApplicationDelegate
subclass can conform to the CarPlayManagerDelegate
protocol to manage handoffs between NavigationViewController
and the CarPlay device, as well as to customize some aspects of the CarPlay navigation experience. To take advantage of CarPlay functionality, your application must have a CarPlay navigation application entitlement and be built in Xcode 10 or above, and the user’s iPhone or iPad must have iOS 12 or above installed.
Core Navigation
MapboxNavigationService
is responsible for receiving user location updates and determining their relation to the route line. If you build a completely custom navigation UI, this is the class your code would interact with directly. The NavigationServiceDelegate
protocol allows your application to react to location-related events as they occur. Corresponding Notification
s from the NavigationService
‘s RouteController
are also posted to the shared NotificationCenter
. These notifications indicate the current state of the application in the form of a RouteProgress
object.
For further details, consult the guides and examples included with this API reference. If you have any questions, please see our help page. We welcome your bug reports, feature requests, and contributions.
Changes in version 2.0.0
Pricing
- New per trip pricing option. For more information, see the “Pricing” guide (#3147, #3338)
MBXNavigationBillingMethod
is no longer supported. (#3147)
Packaging
- The Mapbox Navigation SDK for iOS license has changed from the ISC License to the Mapbox Terms of Service. (#2808)
- You can now install MapboxNavigation using Swift Package Manager, but you can no longer install it using Carthage. If you previously installed MapboxNavigation using Carthage, use Swift Package Manager instead. (#2808)
- MapboxNavigation now depends on MapboxMaps v10.0.0-rc.7. (#3297)
- MapboxNavigation now depends on MapboxNavigationNative v65.0.1. (#3320)
- MapboxNavigation now depends on MapboxCommon v17.1.0. (#3297)
- MapboxNavigation now depends on MapboxMobileEvents v1.0.3. (#3320)
- MapboxCoreNavigation depends on MapboxDirections v2.0.0-rc.1. (#3325)
- MapboxCoreNavigation no longer depends on MapboxAccounts. (#2829)
- MapboxNavigation now depends on Turf v2.0.0-rc.1. (#3248)
- MapboxNavigation and MapboxCoreNavigation require iOS 11.0 or above to run. iOS 10.x is no longer supported. (#2808)
- Xcode 12.4 or above is now required for building this SDK from source.
- Carthage v0.38 or above is now required for installing this SDK if you use Carthage. (#3031)
- You can fully build this SDK on Macs with Apple Silicon. (#3031)
- Removed the optional dependency on MapboxGeocoder.swift. (#2999, #3183
- Added a Castilian Spanish localization. (#3186)
Map
- To gain access to Mapbox server APIs, set
MBXAccessToken
in your Info.plist.MGLMapboxAccessToken
is still supported but is now deprecated. (#2837) - Removed the obsolete
NavigationMapView.navigationMapDelegate
property in favor ofNavigationMapView.delegate
. (#2808) - Renamed the
NavigationMapView.navigationMapViewDelegate
property toNavigationMapView.delegate
. (#2808) - Renamed the
NavigationViewController.mapView
property toNavigationViewController.navigationMapView
. (#2808) - Removed
NavigationAnnotation
. (#2808) NavigationMapView.updateCourseTracking(location:camera:animated:)
no longer acceptsMGLMapCamera
as parameter, and usesCameraOptions
instead. (#2808)- Removed
NavigationMapView.showsUserLocation
becauseNavigationMapView
is no longer inherited fromMGLMapView
.NavigationMapView.mapView
is now exposed as public property instead. (#2808) - Changed the
NavigationViewController.pendingCamera
property’s type fromMGLMapCamera
toCameraOptions
. (#2808) - Renamed the
Constants.MBRouteLineWidthByZoomLevel
property toConstants.MBRouteLineWidthByZoomLevel
, which now acceptsDouble
for keys and values. (#2808) - Renamed the
MBCurrentLegAttribute
constant toCurrentLegAttribute
. (#2808) - Renamed the
MBCongestionAttribute
constant toCongestionAttribute
. (#2808) - Renamed the
NavigationViewController.mapView
property toNavigationViewController.navigationMapView
. (#2808) - Renamed the
NavigationMapView.highlightBuildings(at:in3D:)
method toNavigationMapView.highlightBuildings(at:in3D:completion:)
. (#2827) - Renamed the
MGLStyle.navigationDayStyleURL
andMGLStyle.navigationNightStyleURL
properties toStyleURI.navigationDay
andStyleURI.navigationNight
, respectively. Removed theMGLStyle.navigationDayStyleURL(version:)
andMGLStyle.navigationNightStyleURL(version:)
methods in favor of these renamed properties. (#3332) - Added the
NavigationMapView.showsCongestionForAlternativeRoutes
property to show congestion levels with different colors on alternative route lines. (#2887) - Added the
NavigationMapView.navigationMapView(_:didAdd:pointAnnotationManager:)
andNavigationViewController.navigationViewController(_:didAdd:pointAnnotationManager:)
delegate methods, which will be called whenever final destinationPointAnnotation
is added toNavigationMapView
orNavigationViewController
respectively. MadeNavigationMapView.pointAnnotationManager
public. (#2961, #3109) - Added the ability to show specific route leg with color overriding. When specifying the
legIndex
inNavigationMapView.show(_:legIndex:)
, the route line for the specific route leg would show congestion colors, while other route legs would showNavigationMapView.routeCasingColor
by default. If not specified, all the route legs would show congestion colors. During turn-by-turn navigation, the default specified route leg is the current route leg. The route leg colors could be overridden byNavigationMapView.routeCasingColor
and the congestion colors. (#2833) - Added the
NavigationMapView.userLocationStyle
property to customize how the user’s current location is displayed on the map. Set this property toUserLocationStyle.puck2D(configuration:)
orUserLocationStyle.puck3D(configuration:)
to use the location indicator layer powered by the Mapbox Maps SDK instead of the default view-backed implementation specified by theNavigationMapView.userCourseView
property. (#2968) - If you need to customize the appearance of the user location indicator, you can subclass
UserPuckCourseView
andUserHaloCourseView
as a starting point. (#2968) - Fixed an issue where route line disappears when changing
MapView
style. (#3136) - Added
NavigationOptions.navigationMapView
property to allow customization or reusing possibilities forNavigationViewController.navigationMapView
(#3186). - Renamed the
NavigationMapView.updateRoute(_:)
method toNavigationMapView.travelAlongRouteLine(to:)
. Improved the performance of updating the route line to change color at the user’s location as they progress along the route. (#3201). - Fixed an issue when user passed destination and the route line grows back when
NavigationViewController.routeLineTracksTraversal
is enabled. (#3255) - The
NavigationMapView.userLocationStyle
now supports instant user location indicator change without style loaded lag. (#3295) - Fixed incorrect color-coded traffic congestion along the route line and incorrect speeds in the speed limit view after some time had elapsed after rerouting. (#3344)
Location tracking
- Added the
NavigationLocationProvider
class to conform toLocationProvider
protocol, which depends onNavigationLocationManager
to detect the user’s location as it changes during turn-by-turn navigation.SimulatedLocationManager
andReplayLocationManager
can now be used with a standaloneNavigationMapView
throughNavigationMapView.mapView.location.overrideLocationProvider(with:)
. (#3091) - Renamed
PassiveLocationManager
toPassiveLocationProvider
andPassiveLocationDataSource
toPassiveLocationManager
for consistency withNavigationLocationProvider
andNavigationLocationManager
. (#3091) PassiveLocationProvider
now conforms to theLocationProvider
protocol instead ofMGLLocationManager
. (#2808)- The
PassiveLocationProvider.delegate
property is now of typeLocationProviderDelegate
instead ofMGLLocationManagerDelegate
. (#2808) - Replaced
PassiveLocationManager.accuracyAuthorization()
was replaced with thePassiveLocationProvider.accuracyAuthorization
property, which now returnsCLAccuracyAuthorization
instead ofMBNavigationAccuracyAuthorization
. (#2808) - Fixed a potential hang when
PassiveLocationManager
fails to download routing tiles. (#2808) - Fixed an issue where
RouteController
orPassiveLocationManager
sometimes snapped the user’s location assuming a path that violated a turn restriction. (#2808) - Improved performance and decreased memory usage when downloading routing tiles. (#2808)
- Renamed
PassiveLocationManager.startUpdatingLocation(completionHandler:)
toPassiveLocationProvider.startUpdatingLocation()
. This method now runs synchronously likeCLLocationManager.startUpdatingLocation()
. (#2823) - Added the
RouteController.startRecordingHistory()
,RouteController.stopRecordingHistory(completionHandler:)
,PassiveLocationManager.startRecordingHistory()
, andPassiveLocationManager.stopRecordingHistory(completionHandler:)
methods for recording details about a trip for debugging purposes. (#3157) - Renamed
RouterDataSource.locationProvider
andActiveNavigationEventsManagerDataSource.locationProvider
properties toRouterDataSource.locationManagerType
andActiveNavigationEventsManagerDataSource.locationManagerType
respectively. (#3199) - Adds
NavigationViewControllerDelegate.navigationViewController(_:shouldPreventReroutesWhenArrivingAt:)
, which is called each time the user arrives at a waypoint. By default, this method returns true and prevents rerouting upon arriving. (#3195) - Fixes an issue where the user would be rerouted even if
NavigationViewControllerDelegate.navigationViewController(_:shouldRerouteFrom:)
returnedfalse
. To implement reroute after arrival behavior, returntrue
from this method andfalse
fromNavigationViewControllerDelegate.navigationViewController(_:shouldPreventReroutesWhenArrivingAt:)
, then setNavigationViewController.showsEndOfRouteFeedback
tofalse
. (#3195) - Added
UserHaloCourseView.haloBorderWidth
, which allows to change border of the ring around halo view. (#3309) - Fixed an issue where the
RouteController.indexedRouteResponse
property would remain unchanged after the user is rerouted. (#3344)
Electronic horizon
- While a
RouteController
,PassiveLocationProvider
, orPassiveLocationManager
is tracking the user’s location, you can get notifications about location changes that indicate relevant details in the electronic horizon – the upcoming portion of the routing graph – such as the names of cross streets and upcoming speed limit changes. To receive this information, observe theNotification.Name.electronicHorizonDidUpdatePosition
,Notification.Name.electronicHorizonDidEnterRoadObject
,Notification.Name.electronicHorizonDidExitRoadObject
, andNotification.Name.electronicHorizonDidPassRoadObject
notifications. Use theRouteController.roadGraph
orPassiveLocationManager.roadGraph
property to get more information about the edges contained in these notifications. Optionally set theRouteController.electronicHorizonOptions
orPassiveLocationManager.electronicHorizonOptions
property to configure the extent of electronic horizon calculations. (#2834) - Added
RoadObject
struct which describes the object on the road. (#2991) - Added
DistancedRoadObject
enum which contains information about distance to the road object of a concrete type/shape (gantry, polygon, line, point, subgraph). (#2991) - Added
RoadObjectPosition
struct which contains information about the position of the object on the graph and its geo-position. (#2991) - Added
RoadObjectLocation
enum that represents the location of a road object in the road graph of a concrete type/shape. (#2991) - Added
OpenLROrientation
struct which describes the relationship between the road object and the referenced line. Used forOpenLRLineLocation
struct. (#2991) - Added
OpenLRSideOfRoad
struct which describes the relationship between the road object and the road. Used forOpenLRPointLocation
struct. (#2991) - Added
RoadObjectMatcher
class that creates user-defined road objects by matching location primitives to the road graph. Accessible throughRouteController.roadObjectMatcher
andPassiveLocationManager.roadObjectMatcher
. Matched road object or matching errorRoadObjectMatcherError
is delivered viaRoadObjectMatcherDelegate
. (#3004) - Added
OpenLRStandard
enum which specifies OpenLR standard of encoded OpenLR location. Used for road object matching viaRoadObjectMatcher
. (#3004) - Added
RoadObjectStore.addUserDefinedRoadObject(_:)
,RoadObjectStore.removeUserDefinedRoadObject(identifier:)
, andRoadObjectStore.removeAllUserDefinedRoadObjects()
for adding/removing user-defined road objects to the electronic horizon. (#3004) - Removed
Alert
enum, andalert
,distance
,length
,beginCoordinate
,endCoordinate
,beginSegmentIndex
, andendSegmentIndex
properties fromRouteAlerts
. (#2991) - Added the
RouteAlerts.roadObject
property. (#2991) - Added the
RoadObjectLocation.subgraph
enum case and the correspondingRoadGraph.SubgraphEdge
structure represeting edges in the subgraph. (#3250) - Added the
shape
value to theRoadObjectLocation.subgraph
enum case. (#3301)
Camera
- Added Navigation Viewport Camera APIs, which allow to control camera viewport system frames based on various properties, such as: current location, some or all of the remaining route line coordinates, upcoming maneuvers etc. This allows to provide a camera viewport system, which is optimal for visualization and animation in navigation applications. (#2826)
- Removed
CarPlayNavigationViewController.tracksUserCourse
,NavigationMapView.defaultAltitude
,NavigationMapView.zoomedOutMotorwayAltitude
,NavigationMapView.longManeuverDistance
,NavigationMapView.showsUserLocation
,NavigationMapView.tracksUserCourse
,NavigationMapView.enableFrameByFrameCourseViewTracking(for:)
,NavigationMapView.updateCourseTracking(location:camera:animated:)
NavigationMapView.defaultPadding
,NavigationMapView.setOverheadCameraView(from:along:for:)
,NavigationMapView.recenterMap()
,NavigationMapViewDelegate.navigationMapViewUserAnchorPoint(_:)
,NavigationMapViewCourseTrackingDelegate
,NavigationViewController.pendingCamera
in favor of new Navigation Viewport Camera APIs. (#2826) - Replaced
CourseUpdatable.update(location:pitch:direction:animated:tracksUserCourse:)
withCourseUpdatable.update(location:pitch:direction:animated:navigationCameraState:)
to provide more agile way of handlingNavigationCameraState
. (#2826) - Added
NavigationMapView.init(frame:navigationCameraType:)
to be able to provide type ofNavigationCamera
, which should be used for that specific instance ofNavigationMapView
(either iOS or CarPlay). (#2826) - Added
NavigationCamera
,ViewportDataSourceType
,ViewportDataSourceDelegate
,NavigationCameraState
Navigation Viewport Camera APIs. By default Navigation SDK for iOS provides default camera behavior viaNavigationViewportDataSource
andNavigationCameraStateTransition
classes. If you’d like to override current behavior useViewportDataSource
andCameraStateTransition
protocols for custom behavior. (#2826) - Added
NavigationViewportDataSourceOptions
, which provides the ability to change specificCameraOptions
ofNavigationViewportDataSource
. (#2944) - Added location, bearing and pitch change thresholds based on the zoom level before starting the camera animation under following state, which reduces the power waste by camera animation. Replaced
CameraStateTransition.updateForFollowing(_:)
andCameraStateTransition.updateForOverview(_:)
withCameraStateTransition.update(to:state:)
. (#3155, #3172)
CarPlay
- Removed deprecated
CarPlayNavigationDelegate.carPlayNavigationViewControllerDidArrive(_:)
. (#2808) CarPlayManager.mapView
was renamed toCarPlayManager.navigationMapView
. (#2808)- Removed deprecated
CarPlayManager.overviewButton
. (#2808) - Removed unused
CarPlayNavigationViewController.drivingSide
property. (#2808) - Added
CarPlayManagerDelegate.carPlayManager(_:shouldPresentArrivalUIFor:)
andCarPlayNavigationViewController.navigationService(_:didArriveAt:)
to allow developers to determine whether to present Arrival UI for CarPlay. (#3016) - Renamed
CarPlayNavigationDelegate
toCarPlayNavigationViewControllerDelegate
andCarPlayNavigationViewController.carPlayNavigationDelegate
toCarPlayNavigationViewController.delegate
. (#3036) - Changed access level of
styleManager
inCarPlayNavigationViewController
andCarPlayMapViewController
from default topublic private(set)
. (#3137) - Moved
CarPlaySearchController.searchTemplate(_:updatedSearchText:completionHandler:)
,CarPlaySearchController.searchTemplate(_:searchTemplate:selectedResult:completionHandler:)
methods toCarPlaySearchControllerDelegate
protocol. RenamedresultsOrNoResults(_:limit:)
tosearchResults(with:limit:)
. (#2999) CarPlaySearchControllerDelegate
now conforms toCPSearchTemplateDelegate
protocol. (#2999)AppDelegate
now extendsCarPlaySearchControllerDelegate
. (#2999)- Moved
GeocodedPlacemark
extension fromCarPlaySearchController
to the application level. RemovedGeocodedPlacemark.listItem()
. (#2999) - Added
NavigationGeocodedPlacemark
struct to replaceGeocodedPlacemark
and addedNavigationGeocodedPlacemark.listItem()
. (#2999) RecentItem
is now a public struct. (#2999)- Added the
CarPlayMapViewControllerDelegate
public protocol, which provides methods for reacting to events during free-drive navigation or route previewing. (#3190) - Added the
CarPlayMapViewControllerDelegate.carPlayMapViewController(_:didAdd:pointAnnotationManager:)
,CarPlayNavigationViewControllerDelegate.carPlayNavigationViewController(_:didAdd:pointAnnotationManager:)
andCarPlayManager.carPlayManager(_:didAdd:to:pointAnnotationManager:)
delegate methods, which will be called whenever thePointAnnotation
representing the final destination is added toCarPlayMapViewController
,CarPlayNavigationViewController
andCarPlayManager
, respectively. (#3190) - Added the ability to show speed limit indicator on CarPlay during free-drive. (#3197)
CarPlayManagerDelegate.carPlayManager(_:navigationServiceAlong:routeIndex:routeOptions:desiredSimulationMode:)
now requires optionalNavigationService
. In case ifNavigationService
was not providedMapboxNavigationService
will be used by default. (#3208)CarPlayManagerDelegate.carplayManagerShouldDisableIdleTimer(_:)
was renamed toCarPlayManagerDelegate.carPlayManagerShouldDisableIdleTimer(_:)
. (#3208)- Added
CarPlayManagerDelegate.carPlayManager(_:templateWillAppear:animated:)
,carPlayManager(_:templateDidAppear:animated:)
,carPlayManager(_:templateWillDisappear:animated:)
, andcarPlayManager(_:templateDidDisappear:animated:)
to pass through the corresponding methods fromCPInterfaceControllerDelegate
. (#3219)
Other changes
- Removed deprecated
InstructionsBannerViewDelegate.didDragInstructionsBanner(_:)
method. (#2808) - Removed
NavigationViewController.origin
property, which was not used. (#2808) - A new predictive cache proactively fetches tiles which may become necessary if the device loses its Internet connection at some point during passive or active turn-by-turn navigation. Pass a
PredictiveCacheOptions
instance into theNavigationOptions(styles:navigationService:voiceController:topBanner:bottomBanner:predictiveCacheOptions:)
initializer as you configure aNavigationViewController
, or manually callNavigationMapView.enablePredictiveCaching(options:)
. (#2830) - Added the
Directions.calculateOffline(options:completionHandler:)
andDirections.calculateWithCache(options:completionHandler:)
methods, which incorporate routing tiles from the predictive cache when possible to avoid relying on a network connection to calculate the route.RouteController
now also uses the predictive cache when rerouting. (#2848) - Fixed an issue where
PassiveLocationManager
andRouteController
did not use the access token and host specified byPassiveLocationDataSource.directions
andRouteController.directions
, respectively. Added thePredictiveCacheOptions.credentials
property for specifying the access token and host used for prefetching resources. (#2876) - The top banner can now show a wider variety of turn lane configurations, such as combination U-turn/left turn lanes and combination through/slight right turn lanes. (#2882)
- Exposed
NavigationMapView.mapTileStore
,PassiveLocationManager.navigatorTileStore
andRouteController.navigatorTileStore
for accessing correspondingTileStore
instancies (#2955) - Fixed an issue that the current road name label flashes when camera state changes or travels onto an unnamed road. (#2958)
- Fixed an issue where lane guidance icons would sometimes highlight the wrong arrow.(#2942)
- The duration annotations added by the
NavigationMapView.showRouteDurations(along:)
method are now set in the fonts you specify using theNavigationMapView.routeDurationAnnotationFontNames
property. Use this property to specify a list of fallback fonts for better language support. (#2873) - Removed deprecated and obsoleted
EventsManager
typealias,StatusView.delegate
,StatusView.canChangeValue
,RouteLegProgress.upComingStep
,StatusViewDelegate
,DeprecatedStatusViewDelegate
andBottomBannerViewController.init(delegate:)
. (#2993) - Fixed a potential memory leak when using
MultiplexedSpeechSynthesizer
. (#3005) - Fixed an issue where instruction banners could appear in the wrong color after switching between
Style
s. (#2977) - Developers can create an instance of
NavigationViewController
fromUIStoryboardSegue
, which is located inNavigation.storyboard
. To successfully createNavigationViewController
instance developer has to pre-defineroute
,routeIndex
,routeOptions
andnavigationOptions
properties ofNavigationViewController
inUIViewController.prepare(for:sender:)
. (#2974) - Added methods for convenience checking Navigation tiles in a
TileStore
:TileStore.containsLatestNavigationTiles(completion:)
,TileStore.tileRegionContainsLatestNavigationTiles(forId:completion:)
and methods for getting Navigation tiles fromTilesetDescriptorFactory
:TilesetDescriptorFactory.getLatest(completionQueue:completion)
,TilesetDescriptorFactory.getSpecificVersion(version:completionQueue:completion:)
. Tilestore location is obtained fromNavigationSettings.tileStoreConfiguration
. (#3015, #3164, #3215) - Fixed a thread-safety issue in
UnimplementedLogging
protocol implementation. (#3024) - Implemented automatic switching to older navigation tiles versions (if they are present in current
TileStore
) and back. You can subscribe toNotification.Name.navigationDidSwitchToFallbackVersion
andNotification.Name.navigationDidSwitchToTargetVersion
notifications to monitor such events. (#3014) - Fixed an issue where the current road name label sometimes displayed the name of an intersecting road instead of the current road or blinked in and out. (#3257)
- Fixed an issue where 'Navigation cancel’ event might be not logged. (#3050)
- Fixed an issue where offline route calculation might hang up. (#3040)
- Fixed the moment of custom feedback event creation. (#3049)
- Increased stability of unit tests by addressing sporadic failures. (#3089)(#3072)
- Fixed a retain cycle in
UserCourseView
. (#3120) - The
ActiveNavigationEventsManagerDataSource.router
,NavigationService.router
,NavigationService.eventsManager
,MapboxNavigationService.router
,MapboxNavigationService.eventsManager
properties are no longer force unwrapped. (#3055) - Fixed an issue where traffic congestion segments along the route line blurred into each other when the map was zoomed in far enough. (#3153)
- You can now solicit user feedback about
PassiveLocationManager
andNavigationMapView
outside of active turn-by-turn navigation. UsePassiveLocationManager.eventsManager
property ofNavigationEventsManager
type to create and send user feedback. You can use aFeedbackViewController
to present the user with the same options as during turn-by-turn navigation. Alternatively, if you present a custom feedback UI, call theNavigationEventsManager.createFeedback()
method and configure the resultingFeedbackEvent
with any additional context. (#3122, #3322) - You can now manage the feedback event lifecycle, allowing the user to submit additional details later. Use
NavigationEventsManager.createFeedback()
to create aFeedbackEvent
andNavigationEventsManager.sendActiveNavigationFeedback(_:type:description:)
to send it to Mapbox.FeedbackEvent
conforms to theCodable
protocol, so your application can store incomplete feedback across sessions if necessary. (#3154, #3318) - To submit feedback during passive navigation use
NavigationEventsManager.createFeedback()
to create aFeedbackEvent
andNavigationEventsManager.sendPassiveNavigationFeedback(_:type:description:)
to send it to Mapbox. This method acceptsPassiveNavigationFeedbackType
with feedback types specific to the passive navigation. (#3154, #3318) NavigationViewController.indexedRoute
,NavigationService.indexedRoute
andRouter.indexedRoute
properties are readonly now. Use dedicatedRouter.updateRoute(with:routeOptions:)
method to update the route. (#3159)- Removed the
NavigationViewController.indexedRoute
,NavigationService.indexedRoute
,Router.indexedRoute
properties in favor ofNavigationViewController.indexedRouteResponse
,NavigationService.indexedRouteResponse
, andRouter.indexedRouteResponse
. Removed theRouteProgress.indexedRoute
property. AddedNavigationViewController.prepareViewLoading(routeResponse:, routeIndex:, routeOptions:, navigationOptions:)
method to setup it forUIStoryboard
. (#3182) - Fixed an issue where a subclass of
NavigationRouteOptions
would turn into an ordinaryRouteOptions
when rerouting the user. (#3192) - Renamed
RouteOptions.without(waypoint:)
toRouteOptions.without(_:)
. (#3192) - Added optional
NavigationEventsManager.userInfo
property that can be sent with all navigation events. The new optional property contains application metadata, such as the application name and version, that is included in each event to help Mapbox triage and diagnose unexpected behavior. (#3007). - Fixed an issue when
GenericRouteShield
images would ignore changing it’s foreground color in favor of cached image. (#3217) - Fixed an issue when route line was sometimes invisilbe after starting active guidance session. (#3205)
- Fixed an issue where reusing
NavigationMapView
across multiple instances ofNavigationViewController
would result in a crash. (#3222) - Fixed missing feedback subtype description for
ActiveNavigationFeedbackType.incorrectVisual(subtype: .incorrectSpeedLimit)
and all “other” subtypes. (#3238) - Fixed an issue where the first location update was incorrectly generated in the
NavigationService.start()
method. (#3239) - Fixed an issue where
UIApplication.shared.isIdleTimerDisabled
was not properly set in some cases. (#3245) - Added the
Notification.Name.currentRoadNameDidChange
to detect the road name posted byRouteController
. (#3266) - Fixes an issue when not all navigation status events were handled, leading to missing banner instructions. (#3265)
- Added two new properties
NavigationSettings
:NavigationSettings.directions
andNavigationSettings.tileStoreConfiguration
. (#3215) - Directions parameter in
LegacyRouteController.init(alongRouteAtIndex:in:options:directions:dataSource:)
,PassiveLocationManager.init(directions:systemLocationManager:)
,RouteController.init(alongRouteAtIndex:in:options:directions:dataSource:)
,MapboxNavigationService.init(routeResponse:routeIndex:routeOptions:directions:locationSource:eventsManagerType:simulating:routerType:)
now defaults toNavigationSettings.directions
. (#3215) - Removed
tileStoreLocation
parameter fromMapboxNavigationService.init(routeResponse:routeIndex:routeOptions:directions:locationSource:eventsManagerType:simulating:routerType:)
,PassiveLocationManager.init(directions:systemLocationManager:)
,RouteController.init(alongRouteAtIndex:in:options:directions:dataSource:)
,Router.init(alongRouteAtIndex:in:options:directions:dataSource:)
in favor ofNavigationSettings.tileStoreConfiguration
. (#3215) - Removed
cacheLocation
parameter fromTileStore.containsLatestNavigationTiles(completion:)
,TileStore.tileRegionContainsLatestNavigationTiles(forId:completion:)
,TilesetDescriptorFactory.getSpecificVersion(version:completionQueue:completion:)
,TilesetDescriptorFactory.getLatest(completionQueue:completion:)
. Cache location is obtained fromNavigationSettings.tileStoreConfiguration
now. (#3215) - Removed
NavigationOptions.tileStoreConfiguration
in favor ofNavigationSettings.tileStoreConfiguration
. (#3215) - Removed
tileStoreConfiguration
parameterPredictiveCacheManager.init(predictiveCacheOptions:styleSourcePaths:)
in favor ofNavigationSettings.tileStoreConfiguration
. (#3215) NavigationViewController.mapTileStore
is now obtained fromNavigationSettings.tileStoreConfiguration
. (#3215)- Removed
tileStoreConfiguration
parameter fromNavigationMapView.enablePredictiveCaching(options:)
in favor ofNavigationSettings.tileStoreConfiguration
. (#3215) - Fixed an issue, which prevented the ability to change
UserPuckCourseView.puckColor
when changing system-wide appearance. (#3306) FeedbackViewController
now can be customized to show only feedback types specific to passive navigation. PassFeedbackViewControllerType
to the constructor of the feedback view controller to configure the available feedback categories. (#3323)- Renamed
FeedbackType
toActiveNavigationFeedbackType
andEventsManagerDataSource
toActiveNavigationEventsManagerDataSource
. (#3327) - Fixed an issue when road label resolving during the active navigation was consuming too much CPU and might lead to crashes. (#3340)
- Feedback categories and subcategories for active navigation were changed. “Incorrect visual” category was renamed to “Looks Incorrect”. For the full updated list of supported categories see enum
ActiveNavigationFeedbackType
. (#3339 - Fixed bundle names retrieval in
URLSession.userAgent
. (#3335 - Fixed IndexedRouteResponse handling after rerouting. (#3344