-
Notifications
You must be signed in to change notification settings - Fork 316
Upgrading from v0.40.x to v1.0.x
Mapbox Navigation SDK for iOS v1.0.0 is the first major version of this SDK since the project started in 2016. To upgrade, follow the installation instructions. Note the new installation steps, including creating a secret Mapbox access token and adding it to a .netrc file.
Version 1.0.0 includes numerous important changes to the public APIs of the MapboxNavigation and MapboxCoreNavigation frameworks as well as their dependencies. There are several backwards-incompatible changes to be aware of as you upgrade, which are discussed below and divided by framework so that you can upgrade different portions of your application at different times.
- Minimum Carthage version required to install the SDK (if using Carthage): 0.35
- Minimum Xcode version required to build the SDK: 11.4.1
- Minimum iOS deployment target: 10.0
-
CoordinateBounds
class was replaced byBoundingBox
. -
Polyline
is replaced withLineString
. - Review existing
Polyline.closestCoordinate(to:)
and otherLineString.IndexedCoordinate
usage as its.distance
property now reflects it's description. Previously,Polyline.closestCoordinate(to:)
showed distance between provided coordinate and the closestPolyline
point. Now, it shows distance fromPolyline
's first point, as stated in the doc.
Number of entities was renamed or replaced:
-
Tracepoint.alternateCount
renamed toTracepoint.countOfAlternatives
. -
MBDefaultWalkingSpeed
replaced byCLLocationSpeed.normalWalking
-
MBMinimumWalkingSpeed
replaced byCLLocationSpeed.minimumWalking
-
MBMaximumWalkingSpeed
replaced byCLLocationSpeed.maximumWalking
-
Route.coordinates
replaced byRoute.shape
-
RouteStep.coordinates
replaced byRouteStep.shape
-
Route.coordinateCount
andRouteStep.coordinateCount
properties have been removed, useLineString.coordinates
instead.
Other changes:
-
TransportType.none
,ManeuverType.none
, andManeuverDirection.none
are removed. To handle those cases, addcatch
ing decoding error. - Removed the
Lane
class in favor of storing an array ofLaneIndications
directly in theIntersection.approachLanes property
. - Removed the
ComponentRepresentable
protocol,VisualInstructionComponent
class, andLaneIndicationComponent
class in favor of a VisualInstruction.Component enumeration that contains a VisualInstruction.Component.TextRepresentation and/or VisualInstruction.Component.ImageRepresentation, depending on the type of component. - The
RouteCompletionHandler
andMatchCompletionHandler
closures’error
argument is now aDirectionsError
instead of anNSError
. Update callbacks accordingly. - Classes such as
Route
,Match
, andRouteStep
conform to theCodable
protocol. If you had your own implementation, remove it.
By default, usage of Mapbox APIs is now billed together based on monthly active users rather than individually by HTTP request. Learn more in the pricing by product documentation.
Symbols renamed or replaced:
- The
MGLStyle.navigationDayStyleURL
andMGLStyle.navigationNightStyleURL
properties contain URLs to the Mapbox Navigation Day and Night v5 styles, both of which show traffic congestion lines on all roads by default. The traffic congestion layer is appropriate for a preview map; to tailor the style to turn-by-turn navigation, setMGLMapView.showsTraffic
tofalse
. - Replaced the
MGLStyle.navigationPreviewDayStyleURL
andMGLStyle.navigationGuidanceDayStyleURL
properties withMGLStyle.navigationDayStyleURL
, and replacedMGLStyle.navigationPreviewNightStyleURL
andMGLStyle.navigationGuidanceNightStyleURL
withMGLStyle.navigationNightStyleURL
. - Removed
NavigationMapViewDelegate.navigationMapView(_:routeStyleLayerWithIdentifier:source:)
,NavigationMapViewDelegate.navigationMapView(_:routeCasingStyleLayerWithIdentifier:source:)
in favor of four new delegate methods to customize the route styling. - Removed the
NavigationViewControllerDelegate.navigationViewController(_:imageFor:)
andNavigationViewControllerDelegate.navigationViewController(_:viewFor:)
methods in favor ofMGLMapViewDelegate.mapView(_:imageFor:)
andMGLMapViewDelegate.mapView(_:viewFor:)
, respectively. - Deprecated
NavigationMapView.showRoutes(_:, legIndex:)
andNavigationMapView.showWaypoints(_:legIndex:)
methods. UseNavigationMapView.show(_:, legIndex:)
andNavigationMapView.showWaypoints(on:legIndex:)
instead. - The following methods now require a route index to be passed in as an argument:
NavigationViewController(for:routeIndex:routeOptions:navigationOptions:)
NavigationViewController(route:routeIndex:routeOptions:navigationService:)
CarPlayManagerDelegate.carPlayManager(_:navigationServiceAlong:routeIndex:routeOptions:desiredSimulationMode:)
MapboxNavigationService(route:routeIndex:routeOptions:)
MapboxNavigationService(route:routeIndex:routeOptions:directions:locationSource:eventsManagerType:simulating:routerType:)
RouteProgress(route:routeIndex:options:legIndex:spokenInstructionIndex:)
RouteProgress(route:routeIndex:options:legIndex:spokenInstructionIndex:)
Router(along:routeIndex:options:directions:dataSource:)
RouteController(along:routeIndex:options:directions:dataSource:)
- The
NavigationViewController.route
andNavigationService.route
properties are now read-only. To change the route that the user is traveling along, set theNavigationViewController.indexedRoute
orNavigationService.indexedRoute
property instead, pairing the route with the index of the route in the originalRouteResponse
object. - Replaced
RouteVoiceController
andMapboxVoiceController
withMultiplexedSpeechSynthesizer
.MultiplexedSpeechSynthesizer
coordinates multiple cascading speech synthesizers. By default, the controller still tries to speak instructions via the Mapbox Voice API (MapboxSpeechSynthesizer
) before falling back to VoiceOver (SystemSpeechSynthesizer
), but you can also provide your own speech synthesizer that conforms to theSpeechSynthesizing
protocol. - Deprecated
NavigationDirectionsCompletionHandler
,OfflineRoutingError
,UnpackProgressHandler
,UnpackCompletionHandler
,OfflineRouteCompletionHandler
, andNavigationDirections
. UseDirections
instead ofNavigationDirections
to calculate a route. - Reorganized
FeedbackType
cases:- Removed
FeedbackType.accident
,FeedbackType.hazard
,FeedbackType.reportTraffic
, andFeedbackType.mapIssue
. - Renamed
FeedbackType.roadClosed
andFeedbackType.notAllowed
toFeedbackType.roadClosure(subtype:)
andFeedbackType.illegalRoute(subtype:)
, respectively. - Renamed
FeedbackType.routingError
toFeedbackType.routeQuality(subtype:)
. - Renamed
FeedbackType.confusingInstruction
toFeedbackType.confusingAudio(subtype:)
. -
FeedbackType.missingRoad
is now represented asFeedbackType.routeQuality(subtype:)
with a subtype ofRouteQualitySubtype.routeIncludedMissingRoads
. -
FeedbackType.missingExit
is now represented asFeedbackType.incorrectVisual(subtype:)
with a subtype ofIncorrectVisualSubtype.exitInfoIncorrect
.
- Removed
- The
RouteProgress.congestionTravelTimesSegmentsByStep
andRouteProgress.congestionTimesPerStep
properties are now read-only.
Other changes:
- The
MGLStyle.navigationDayStyleURL
andMGLStyle.navigationNightStyleURL
properties contain URLs to the Mapbox Navigation Day and Night v5 styles, both of which show traffic congestion lines on all roads by default. The traffic congestion layer is appropriate for a preview map; to tailor the style to turn-by-turn navigation, setMGLMapView.showsTraffic
tofalse
. - Any classes, methods, or properties that were deprecated in v0.40.0 are no longer available. See your project’s build errors for details about replacements.
If you have any questions, please contact Mapbox’s support team.