- Added
Incident.trafficCodes
and correspondingTrafficCodes
struct to hold jartic codes. (#808)
- Added
Matrix
API wrapper. The Mapbox Matrix API computes travel times between many points, and returns a matrix of all travel times between the locations. #626 - Fixed a crash that could occur if only one
Waypoint
with a nonnullname
was used in the Directions request. #797 - Added
Interchange
andJunction
structs describing IC and JCT. #799 - Fixed an issue where using
cashTollOnly
for road class exclusions failed the directions request. (#801)
- Added the
RestStop.amenities
property that describes useful and important facilities such as gas stations, restaurants, and ATMs. (#780)
- This library now requires a minimum deployment target of iOS 12.0 or above, macOS 10.14.0 or above, tvOS 12.0 or above, or watchOS 5.0 or above. Older operating system versions are no longer supported. (#736)
- Added the
Waypoint.layer
property, which can ensure that the route begins on the correct road if it is above or below another road. (#745) - Added the
AttributeOptions.update(customOption:comparisonPolicy:)
method andAttributeOptions.customOptionsByRawValue
property for specifying attribute options that are still marked as beta in the Mapbox Directions API. (#748) - Fixed stale
Incident.shapeIndexRange
values even after calling theRouteRefreshResponse.refreshLegIncidents(from:legIndex:legShapeIndex:)
method. (#752) - Added the
RouteLeg.closures
property containing information about road closures based on live traffic conditions. This information requires addingAttributeOptions.closures
to theRouteOptions.attributeOptions
property and setting theDirectionsOptions.profileIdentifier
property toProfileIdentifier.automobileAvoidingTraffic
. (#755) - Added the
Route.refresh(from:refreshParameters:)
method as a single entry point for refreshing various parameters of theRoute
object. (#755)
- This release of MapboxDirections requires Turf v2.5.x to work around a dependency resolution failure. If you use Carthage, it requires Turf v2.5.0 exactly. (#766)
- Xcode 13.0 or above and Swift 5.5 or above are now required to build MapboxDirections from source. (#725, #727)
- Removed the
--config
option. Instead, pass in either the path to a JSON configuration file or the full URL to a Mapbox Directions API or Mapbox Map Matching API request. (#726) - When the
MAPBOX_ACCESS_TOKEN
environment variable is unset, the tool exits with an error code instead of crashing. (#728) - The tool now connects to the API endpoint in the
MAPBOX_HOST
environment variable, if specified. (#728)
- Added
Waypoint.allowsSnappingToStaticallyClosedRoad
property to allow snapping the waypoint’s location to a statically (long-term) closed part of a road. (#721) RouteOptions(url:)
now returnsnil
if given a Mapbox Map Matching API request URL, andMatchOptions(url:)
returnsnil
if given a Mapbox Directions API request URL. (#728)- Added the
Directions.refreshRoute(responseIdentifier:routeIndex:fromLegAtIndex:currentRouteShapeIndex:completionHandler:)
method, which takes the index into the route geometry at which to begin refreshing, as well as correspondingDirections.urlRequest(forRefreshing responseIdentifier:routeIndex:fromLegAtIndex:currentRouteShapeIndex:)
,RouteRefreshResponse.refreshLegAttributes(from:legIndex:legShapeIndex:)
, andRouteRefreshResponse.refreshLegIncidents(from:legIndex:legShapeIndex:)
methods. (#733)
- This release of MapboxDirections requires Turf v2.5.x to work around a dependency resolution failure. If you use Carthage, it requires Turf v2.5.0 exactly. (#771)
- MapboxDirections now requires Turf v2.4. (#703)
- Added the
RouteOptions.maximumWeight
property to compute routes that excludes roads with a lower weight limit. (#694) - Added
Route.refreshLegIncidents(from:)
method to allow refreshingRouteLeg.incidents
during a route refresh. (#704) - Added the
Intersection.railroadCrossing
,Intersection.trafficSignal
,Intersection.stopSign
andIntersection.yieldSign
properties to indicate the kind of traffic control devices at an intersection along the route. (#706)
- Added the
RestStop.name
property. (#689) - Added the
TollCollection.name
property. (#691) - Types that correspond to objects in the Mapbox Directions API response, such as
RouteResponse
,RouteRefreshResponse
,MatchResponse
, andRouteStep
, now conform to theForeignMemberContainer
andForeignMemberClassContainer
protocols. Types that conform to these protocols can persist unrecognized properties in the response, such as properties that are in beta, even after coding and decoding. You can access these properties using theForeignMemberContainer.foreignMembers
andForeignMemberClassContainer.foreignMembers
properties. (#669) - Fixed an issue where
RouteStep.distance
,RouteStep.expectedTravelTime
andRouteStep.typicalTravelTime
were rounded to one decimal place when being encoded. (#697) - Fixed an issue where decoding a
RouteResponse
incorrectly set theWaypoint.snappedDistance
property tonil
. (#669) - The
mapbox-directions-swift
command line tool now requests routes from the Mapbox Directions API if no input file is specified. (#576)
- Fixed a crash that occurred when
RouteOptions.roadClassesToAvoid
orRouteOptions.roadClassesToAllow
properties contained multiple road classes. RoadClasses.tunnel
andRoadClasses.restricted
are no longer supported inRouteOptions.roadClassesToAvoid
orRouteOptions.roadClassesToAllow
properties- Added
DirectionsOptions(url:)
,RouteOptions(url:)
and extended existingDirectionsOptions(waypoints:profileIdentifier:queryItems:)
,RouteOptions(waypoints:profileIdentifier:queryItems:)
,MatchOptions(waypoints:profileIdentifier:queryItems:)
and related convenience init methods for deserializing corresponding options object using appropriate request URL or it's query items. (#655) - Added
Incident
properties:countryCode
,countryCodeAlpha3
,roadIsClosed
,longDescription
,numberOfBlockedLanes
,congestionLevel
,affectedRoadNames
. (#672) - Added
departAt
andarriveBy
properties toRouteOptions
to allow configuring Directions routes calculation. (#673) - Removed url request's
.json
suffix for Directions and Isochrones to follow V5 scheme. (#678)
- Added
VisualInstruction.Component.ShieldRepresentation
struct and theVisualInstruction.Component.ImageRepresentation.shield
property containing metadata for displaying a highway shield consistent with map styles used by the Mapbox Maps SDK. (#644, #647) - Added a
RouteLeg.viaWaypoints
property that lists the non-leg-separating waypoints (also known as “silent waypoints”) along aRouteLeg
. Previously, you had to filterDirectionsOptions.waypoints
to include only the items whoseWaypoints.separatesLegs
property was set totrue
, then zip them withRouteResponse.routes
. This approach still works in some cases but is not guaranteed to be reliable for all Mapbox Directions API responses in the future. (#656)
- Added the
RouteResponse.roadClassViolations
property, which indicates any requestedRouteOptions.roadClassesToAvoid
values that could not be satisfied when calculating the routes. You can use convenienceRouteResponse.exclusionViolations(routeIndex:legIndex:stepIndex:intersectionIndex:)
method to search for a specific item. (#627) - Fixed an issue where
PolyLineString
encoded an invalid GeoJSON LineString. (#638) - Added
RouteRefreshSource
protocol to allow refreshingRoute
objects withRefreshedRoute
or anotherRoute
instance. (#634)
- Added the
Waypoint.snappedDistance
property to get the straight-line distance from the waypoint to the location it was snapped to in theRouteResponse
. (#616) - Added the
RouteOptions.initialManeuverAvoidanceRadius
property to avoid a sudden maneuver when calculating a route while the user is in motion. (#609) - Added the
RoadClasses.unpaved
option for avoiding unpaved roads. (#620) - Added the
RoadClasses.cashOnlyToll
property for avoiding toll roads that only accept cash payment. (#620) - Added
Isochrones
, which connects to the Mapbox Isochrone API to compute areas that are reachable within a specified amount of time from a location and return the reachable regions as contours of polygons or lines that you can display on a map. (#621) - Renamed
DirectionsCredentials
andDirectionsProfileIdentifier
toCredentials
andProfileIdentifier
, respectively. (#621) - Added the
RouteOptions.maximumHeight
andRouteOptions.maximumWidth
properties for ensuring that the resulting routes can accommodate a vehicle of a certain size. (#623) - The
DirectionsPriority
struct now conforms to theCodable
protocol. (#623) - Fixed an issue where the
RouteOptions.alleyPriority
,RouteOptions.walkwayPriority
, andRouteOptions.speed
properties were excluded from the encoded representation of aRouteOptions
object. (#623)
- To gain access to the Mapbox Directions and Map Matching APIs, set
MBXAccessToken
in your Info.plist.MGLMapboxAccessToken
is still supported but is now deprecated. (#522) - MapboxDirections now requires Turf v2.x. (#571, #608)
- Carthage v0.38 or above is now required for installing this SDK if you use Carthage. (#548)
- Xcode 12.0 or above is now required to build MapboxDirections from source. (#548)
- You can fully build this SDK on Macs with Apple Silicon. (#548)
- The
mapbox-directions-swift
command line tool can no longer be built using Carthage. It now requires swift-argument-parser v1.0.0 or above. (#606)
- The
Incident.impact
property is now anIncident.Impact
value instead of a string. (#519) RouteOptions.alleyPriority
,RouteOptions.walkwayPriority
, andRouteOptions.speed
are now optional. Set them explicitly if you want to include them in the HTTP request. RenamedDirectionsOptions.default
toDirectionsOptions.medium
. (#557)- Removed the
DirectionsResult.routeIdentifier
property. Use theRouteResponse.identifier
property in conjunction with an index into theRouteResponse.routes
array instead. (#562) - Added the
Intersection.preferredApproachLanes
andIntersection.usableLaneIndication
properties that indicate preferred lane usage.VisualInstruction.Component.lane(indications:isUsable:)
has been renamed toVisualInstruction.Component.lane(indications:isUsable:preferredDirection:)
. (#529) - Comparing two
Intersection
s with==
now considers whether theIntersection.restStop
,Intersection.regionCode
, andIntersection.outletMapboxStreetsRoadClass
properties are equal. (#529) - Added the
Waypoint.allowsSnappingToClosedRoad
property to allow snapping the waypoint’s location to a closed part of a road. (#583) - Added
AttributeOptions.numericCongestionLevel
,RouteLeg.segmentNumericCongestionLevels
,RouteLeg.Attributes.segmentNumericCongestionLevels
andNumericCongestionLevel
to support receiving the numeric value for congestion level along each segment of aRouteLeg
. (#575) - Added a
RouteOptions.roadClassesToAllow
property that enables the resulting routes to use HOV-only roads or high-occupancy toll roads. (#598) - Added new optional parameters to the
Directions(credentials:urlSession:processingQueue:)
initializer that allow you to provide a customURLSession
and GCD processing queue. (#613) - Fixed an issue where
RouteStep.exitIndex
was always unset. (#567) - Fixed an issue where
RouteLeg.segmentRangesByStep
contained a range that was off by one for the arrival step of a leg. (#587)
- Added support for building and running on any Linux distribution supported by Swift. (#488)
- Added the
MapboxDirectionsCLI
command line tool that round-trips Mapbox Directions API responses between JSON format and Swift model objects. (#469)
- Added the
RouteStep.segmentIndicesByIntersection
property for associatingIntersection
s with portions of the step’s shape. (#490) - Added the
Intersection.outletMapboxStreetsRoadClass
property that indicates a more detailed road classification than the existingIntersection.outletRoadClasses
property. (#507) - Added the
RouteLeg.incidents
property that indicates known traffic incidents, toll collection points, rest areas, and border crossings along the route leg. (#466, #506) - Added the
RouteLeg.regionCode(atStepIndex:intersectionIndex:)
method andIntersection.regionCode
property to get the administrative region where an intersection is located, as well as aRouteLeg.administrativeRegions
property that indicates the administrative regions traversed by the route leg. (#466, #485, #506) - Added the
Intersection.tunnelName
,Intersection.tollCollection
,Intersection.restStop
, andIntersection.isUrban
properties. (#466, #506) - The
CongestionLevel
enumeration now conforms to theCaseIterable
protocol. (#500)
- Added the
DirectionsResult.typicalTravelTime
,RouteLeg.typicalTravelTime
andRouteStep.typicalTravelTime
properties that indicate the typical travel time, as opposed to the current expected travel time. (#462) - Fixed an error that occurred when setting the
Waypoint.separatesLegs
property totrue
and setting theWaypoint.targetCoordinate
property. (#480) Directions.fetchAvailableOfflineVersions(completionHandler:)
now calls its completion handler on the main queue consistently. (#475)- Upgraded to Polyline v5.0.0. (#487)
- Added the
Directions.refreshRoute(responseIdentifier:routeIndex:fromLegAtIndex:completionHandler:)
method for refreshing attributes along the legs of a route and theRoute.refreshLegAttributes(from:)
method for merging the refreshed attributes into an existing route. To enable route refreshing for the routes in a particular route response, setRouteOptions.refreshingEnabled
totrue
before passing theRouteOptions
object intoDirections.calculate(_:completionHandler:)
. (#420) - Fixed a crash that could occur if the Mapbox Directions API includes unrecognized
RoadClasses
values in its response. (#450) - Fixed malformed
RouteStep.shape
values that could occur whenRouteStep.maneuverType
isManeuverType.arrive
,DirectionsOptions.shapeFormat
isRouteShapeFormat.polyline6
, and the Mapbox Directions API returns certain encoded Polyline strings. (#456) - Restored the
DirectionsOptions.urlQueryItems
property so that subclasses ofRouteOptions
andMatchOptions
can add any additional URL query parameters that are supported by the Mapbox Directions and Map Matching APIs. (#461)
- Fixed an issue where waypoints in a
RouteResponse
did not persist theWaypoint.targetCoordinate
,Waypoint.heading
,Waypoint.headingAccuracy
, andWaypoint.allowsArrivingOnOppositeSide
properties from the initialRouteOptions
object.
- Fixed an issue where
RouteResponse(matching:options:credentials:)
andDirections.calculateRoutes(matching:completionHandler:)
resulted in misshappenRoute.shape
s andRouteStep.shape
s in the Atlantic Ocean ifMatchOptions.shapeFormat
was set toRouteShapeFormat.polyline6
. (#437)
- Fixed an issue where decoding and reencoding a JSON-formatted response from the Mapbox Directions API would cause the
voiceLocale
property to be omitted from route objects. (#424) - Added the
Route(legs:shape:distance:expectedTravelTime:)
andRoute(from:)
initializers. (#430) - Fixed an issue where
VisualInstruction.Component.guidanceView
lacked an image URL. (#432)
- Removed the
CoordinateBounds
struct in favor ofBoundingBox
from Turf. (#427) - Added the
VisualInstructionBanner.quaternaryInstruction
property andVisualInstruction.Component.guidanceView(image:alternativeText:)
enumeration case to represent a detailed image of an upcoming junction. (#425)
- Fixed an issue where
RouteResponse(matching:options:credentials:)
andDirections.calculateRoutes(matching:completionHandler:)
resulted in misshappenRoute.shape
s andRouteStep.shape
s in the Atlantic Ocean ifMatchOptions.shapeFormat
was set toRouteShapeFormat.polyline6
. (#437)
- Renamed MapboxDirections.swift to Mapbox Directions for Swift. The CocoaPods pod is now named MapboxDirections, matching the module name. (#400)
- This library now requires a minimum deployment target of iOS 10.0 or above, macOS 10.12.0 or above, tvOS 10.0 or above, or watchOS 3.0 or above. Older operating system versions are no longer supported. (#379)
- Swift is now required to directly use public types and methods defined by this library. If your application is written in Objective-C or Cocoa-AppleScript, you need to implement your own wrapper in Swift that bridges to Objective-C. (#382)
- This library now depends on Turf. (#382)
- The
RouteCompletionHandler
andMatchCompletionHandler
closures’error
argument is now aDirectionsError
instead of anNSError
. (#382) - Classes such as
Route
,Match
, andRouteStep
conform to theCodable
protocol, so you can create instances of them from JSON-formattedData
usingJSONDecoder
and round-trip them back to JSON usingJSONEncoder
. Malformed input now throws decoding errors instead of crashing by unwrappingnil
s. (#382)
- Removed the
Lane
class in favor of storing an array ofLaneIndication
s directly in theIntersection.approachLanes
property. (#382) - Removed the
ComponentRepresentable
protocol,VisualInstructionComponent
class, andLaneIndicationComponent
class in favor of aVisualInstruction.Component
enumeration that contains aVisualInstruction.Component.TextRepresentation
and/orVisualInstruction.Component.ImageRepresentation
, depending on the type of component. (#382) - Added the
VisualInstruction.Component.ImageRepresentation.imageURL(scale:format:)
method for fetching images with scales other than the current screen’s native scale or formats other than PNG. (#382)
- Removed support for Mapbox Directions API v4. (#382)
- Replaced the
MBDefaultWalkingSpeed
,MBMinimumWalkingSpeed
, andMBMaximumWalkingSpeed
constants withCLLocationSpeed.normalWalking
,CLLocationSpeed.minimumWalking
, andCLLocationSpeed.maximumWalking
, respectively. - Replaced the
Route.coordinates
property withRoute.shape
and theRouteStep.coordinates
property withRouteStep.shape
. TheRoute.coordinateCount
andRouteStep.coordinateCount
properties have been removed, but you can use theLineString.coordinates
property to get the array ofCLLocationCoordinate2D
s. (#382) RouteLeg.source
andRouteLeg.destination
are now optional. They can benil
when theRouteLeg
object is decoded individually from JSON. (#382)- Removed
TransportType.none
,ManeuverType.none
, andManeuverDirection.none
. UnrecognizedTransportType
andManeuverDirection
values now raise decoding errors. (#382) RouteStep.maneuverType
is now optional. (#382)- Renamed the
Tracepoint.alternateCount
property toTracepoint.countOfAlternatives
. (#382) - The
Intersection.approachIndex
andIntersection.outletIndex
properties are now optional, not −1, in the case of a departure or arrival maneuver. (#393) - Added initializers for
Route
,Match
,RouteLeg
, andRouteStep
. (#393) - Various properties of
Route
,RouteLeg
, andRouteStep
are now writable. (#393) - Added
AttributeOptions.maximumSpeedLimit
for getting maximum posted speed limits in theRouteLeg.segmentMaximumSpeedLimits
property. (#367) - Added the
RouteLeg.segmentRangesByStep
property for more easily associatingRouteStep
s with the values in segment-based arrays such asRouteLeg.segmentCongestionLevels
. (#367) - The
RouteOptions.alleyPriority
property now works withDirectionsProfileIdentifier.automobile
, allowing you to request routes that prefer or avoid alleys while driving. (#416)
Directions.fetchAvailableOfflineVersions(completionHandler:)
andDirections.downloadTiles(in:version:completionHandler:)
now resumes the data task before returning it to conform to its naming conventions and avoid confusion. (#353)
- Added support for Swift Package Manager. (#362)
- Added the
RouteOptions.alleyPriority
,RouteOptions.walkwayPriority
, andRouteOptions.speed
properties for fine-tuning walking directions. (#370) - Added the
MBStringFromManeuverType()
,MBStringFromManeuverDirection()
,MBStringFromDrivingSide()
, andMBStringFromTransportType()
functions, which are intended for use in Objective-C. (#369)
- Fixed compatibility issues with Xcode 10.2 when the SDK is installed using Carthage. (#363)
- Fixed an issue where
Waypoint.separatesLegs
caused the resultingRouteLeg.source
andRouteLeg.destination
to have mismatched coordinates and names. (#358) - Fixed an issue where a Directions API or Map Matching API request would fail if a
Waypoint
hasWaypoint.name
set andWaypoint.separatesLegs
set tofalse
. (#358)
- Fixed an issue where
Directions.downloadTiles(in:version:session:completionHandler:)
always failed with an error after passing in aCoordinateBounds
created using theCoordinateBounds(northWest:southEast:)
initializer. (#349) - Added a
CoordinateBounds(southWest:northEast:)
initializer. (#349) - The versions passed into the completion handler of
Directions.fetchAvailableOfflineVersions(completionHandler:)
are now sorted in reverse chronological order. (#350)
- Fixed issues where
VisualInstruction
,VisualInstructionBanner
,VisualInstructionComponent
,LaneIndicationComponent
, andRouteOptionsV4
objects failed to roundtrip throughNSCoder
. (#351)
- If a
RouteOptions
object has exceptionally many waypoints or if many of the waypoint have very long names,Directions.calculate(_:completionHandler:)
sends a POST request to the Mapbox Directions API instead of sending a GET request that returns an error. (#341) - When possible,
Directions.calculateRoutes(matching:completionHandler:)
now sends a GET request to the Mapbox Map Matching API instead of a POST request. (#341) - Fixed an issue where certain waypoint names would cause
Directions.calculateRoutes(matching:completionHandler:)
to return an error. (#341) - Added the
Directions.url(forCalculating:httpMethod:)
andDirections.urlRequest(forCalculating:)
methods for implementing custom GET- and POST-compatible request code. (#341) - Added the
Waypoint.separatesLegs
property, which you can set tofalse
to create a route that travels “via” the waypoint but doesn’t stop there. Deprecated theMatchOptions.waypointIndices
property in favor ofWaypoint.separatesLegs
, which also works withRouteOptions
. (#340) - Fixed unset properties in
Waypoint
objects that are included in a calculatedRoute
s orMatch
es. (#340) - Added
DirectionsResult.fetchStartDate
andDirectionsResult.requestEndDate
properties. (#335) - Added a
DirectionsOptions.urlQueryItems
property so that subclasses ofRouteOptions
andMatchOptions
can add any additional URL query parameters that are supported by the Mapbox Directions and Map Matching APIs. (#343)
Waypoint
s andTracepoint
s can now be compared for object equality. (#331)- Fixed an issue where the
DirectionsResult.accessToken
andDirectionsResult.apiEndpoint
properties failed to roundtrip throughNSCoder
. (#331) Route
now supports secure coding via theNSSecureCoding
protocol. (#331)- Fixed an issue where
Intersection
failed to decode when an outlet road has no road classes (i.e., a normal road that isn’t a bridge, tunnel, toll road, or motorway). (#331)
- Renamed
CoordinateBounds(_:)
toCoordinateBounds(coordinates:)
. (#325) - Added a
Waypoint.targetCoordinate
property for specifying a more specific destination for arrival instructions. (#326) - Fixed an issue where the
Waypoint.allowsArrivingOnOppositeSide
property was not copied when copying aWaypoint
object. (#326)
- Fixed an issue where
VisualInstructionComponent(json:)
would setVisualInstructionComponent.imageURL
to an invalid URL when the JSON representation includes an empty image URL. (#322)
- Added the
Directions.apiEndpoint
andDirections.accessToken
properties that reflect the values passed into theDirections
class’s initializers. (#313) - Fixed an issue causing some requests with many waypoints or long waypoint names to fail. (#311)
- Fixed an issue where some requests with very many waypoints would fail silently. (#314)
- Added
Directions.fetchAvailableOfflineVersions(completionHandler:)
for listing available offline versions. (#303) - Added
Directions.downloadTiles(in:version:session:completionHandler:)
for downloading a tile pack. (#303)
- Added
RouteOptions.response(from:)
which can be used for deserializing a response from an external source. (#300)
DirectionsResult
now includes the API response as JSON
- Added
Waypoint.allowsArrivingOnOppositeSide
property for restricting the side of arrival. (#288)
- Added the
VisualInstructionBanner.tertiaryInstruction
property for additional information to display, such as a lane configuration or subsequent turn. Renamed theVisualInstruction.textComponents
property toVisualInstruction.components
. Some of the components may beLaneIndicationComponent
objects, representing a lane at an intersection. (#258) - Fixed a bug which caused coordinates to be off by a factor of 10 when requesting
.polyline6
shape format. (#281) - Removed
MBAttributeOpenStreetMapNodeIdentifier
, as it is no longer being tracked by the API. This is a breaking change. (#275)
- Renamed
VisualInstruction.degrees
toVisualInstruction.finalHeading
. (#266) - Removed support for
MBAttributeOpenStreetMapNodeIdentifier
. (#272) - A named
Waypoint
will now be exposed inVisualInstructionComponent
. (#273)
- Banner instructions object now includes a
degrees
field, corresponding to the location at which the user should exit a roundabout. (#259) - Also introduces a
VisualInstructionBanner
object which now contains the primary and secondaryVisualInstruction
objects. (#259)
- Fixed an issue that caused a warning when using Swift 4.1. (#254, #255)
- Added types
.exit
and.exitCodes
toMBVisualInstructionType
. (#252) - Made an initializer on
MBLane
public. (#253)
This release includes the ability to make a Mapbox Map Matching request.
CompletionHandler
has been renamed toRouteCompletionHandler
to give room forMatchCompletionHandler
.
- Added new class
Match
. AMatch
object defines a single route that was created from a series of points that were matched against a road network. - Added new class
MatchOptions
. AMatchOptions
object is a structure that specifies the criteria for results returned by the Mapbox Map Matching API. - Added
Directions.calculate(matchOptions:completionHandler:)
which returns aMatch
. - Added
Directions.calculateRoutes(matching:completionHandler:)
. This is useful for creating aRoute
from a map matching request.
- Added support for abbreviations to
VisualInstructionComponents
. (#244) - Added new types to
VisualInstructionComponentType
. (#243)
- Added
ManeuverType
andManeuverDirection
toVisualInstructionComponents
(#239)
RouteStep.drivingSide
is now safely unwrapped for cases where the value is missing from the response. (#233)- Added
.tunnel
as a validRoadClass
. (#237) - Added
.speechLocale
toRoute
for deciphering whichLocale
to use for speaking voice instructions. (#235)
- The
maneuverType
,maneuverDirection
, andtransportType
properties ofRouteStep
are now available in Objective-C code. The properties are no longer optional in Swift; check forManeuverType.none
,ManeuverDirection.none
, andTransportType.none
instead ofnil
. (#227)
- API Response parser now handles API JSON response containing empty waypoint names correctly. (#222)
- Added property
drivingSide
toRouteStep
that indicates which side of the road cars and traffic flow. (#219) - Fixed a bug where named
Waypoints
were having their names stripped from the response. (#218) - Moved the class
SpokenInstruction
from private to open for easier testability. (#216)
- Added a
RouteOption.roadClassesToAvoid
property that avoids toll roads, motorways, or ferries. (#180) - The return value of
Directions.calculate(_:completionHandler:)
can be implicitly discarded. (#209)
- Upgraded the project to Swift 4. A final Swift 3.2 version is v0.12.1 and is also available on the branch
swift3.2
. (#196)
- Fixed an issue preventing
Route
objects archived prior to v0.12.0 from unarchiving. (#204)
- The
RouteOptions.locale
property now defaults to the current system locale and is no longer optional in Swift or nullable in Objective-C. (#202) - The
RouteOptions
class now conforms to theNSCopying
protocol. (#200) - Fixed an issue preventing the
RouteOptions.distanceMeasurementSystem
property from round-tripping after theRouteOptions
object is encoded and decoded. (#200) - Clarified the factors that may affect the
RouteStep.expectedTravelTime
property’s accuracy. (#193)
- Changed
RouteOptions.includesVoiceInstructions
toRouteOptions. includesSpokenInstructions
.
- Fixed a bug when decoding a
Route
, if the route did not include alocale
option, it would fail. (#187)
- Added
instructionsSpokenAlongStep
toRouteOptions
. This can be used for getting voice instructions for aRouteStep
(#175) - Added
locale
toRouteOptions
. This can be used for setting the language settings for instructions on aRouteStep
. (#176)
- Fixed build errors in Xcode 9. (#183)
- Added
RouteStep.phoneticNames
andRouteStep.phoneticExitNames
for providing speech synthesizers with accurate road name pronunciation data. (#174)
- Added a
RouteShapeFormat.polyline6
option for enhanced route line precision. (#167) - Added a
RouteOptions.includeExitRoundaboutManeuver
option to get separate steps for entering and exiting each roundabout. (#168, #169)
- Added a
RouteShapeFormat.polyline6
option for enhanced route line precision. (#167) - Added a
RouteOptions.includeExitRoundaboutManeuver
option to get separate steps for entering and exiting each roundabout. (#168, #169)
- Added a
Route.routeIdentifer
property that contains the unique identifier associated with the network request that created the route. (#165)
- While the debugger is paused, you can visually inspect
Route
,RouteLeg
,RouteStep
, andWaypoint
objects using Xcode’s built-in Quick Look feature. (#152) - Fixed an issue causing an exit with multiple exit numbers to correspond to only a single item in the
RouteStep.exitCodes
property. (#149) - Added an
Intersection.outletRoadClasses
property that provides details about the road leading away from the intersection. (#154, #157) - Added properties to
Route
that indicate the access token and API endpoint of theDirections
object that created the route. (#155)
- Added an
AttributeOptions
option,congestion
, for obtaining the level of traffic congestion along each segment of aRouteLeg
. (#123) - Added a
RouteStep.exitCodes
property that contains the exit number of atakeOffRamp
maneuver. (#147) - Renamed
Directions.urlForCalculating(_:)
tourl(forCalculating:)
to adhere to Swift 3 naming conventions. (#138) - If any of the waypoints of
RouteOptions
is named, those names persist in theRouteLeg
s’ waypoints. - Fixed an issue causing
RouteStep
s to fail to decode if themaneuverDirection
was omitted or unrecognized. (#137) - Changed the raw values of the
AttributeOptions
options. (#123)
RouteOptions
now conforms toNSSecureCoding
. (#129)- Multiple
AttributeOptions
values can be specified simultaneously in oneRouteOptions
object. (#129)
- Added an option to RouteOptions for obtaining attributes about each node or segment between nodes in the returned route legs. Available attributes include expected speed and travel time. (#118)
- Replaced Route’s
profileIdentifier
property with arouteOptions
property set to the RouteOptions object that was used to obtain the route. (#122)
- Improved Swift 3.1 compatibility. (#119, raphaelmor/Polyline#43)
- Migrated to Swift 3.0. If your application is written in Swift 2.3, you should stick to v0.7.x or use the swift2.3 branch. (#57)
- Fixed an issue causing the error “The sandbox is not in sync with the Podfile.lock” when updating a Carthage-based project that requires this framework. (#102)
- Replaced the profile identifier constants with the
MBDirectionsProfileIdentifier
extensible string enumeration, which is available to both Objective-C and Swift. (#106)
- Migrated to Swift 2.3.
- Fixed an error that occurred when archiving an application that links to this library. (#108)
- Added the profile identifier constant
MBDirectionsProfileIdentifierAutomobileAvoidingTraffic
for driving routes that avoid traffic congestion. (#86) - Replaced RouteStep’s
name
property with anames
property; each string in the array is a road name that was previously delimited by a semicolon. (#91) - Added a
codes
property to RouteStep that contains any highway route numbers associated with the road. These are the same route numbers that were formerly parenthesized in thename
property. (#91) - Added a
destinations
property to RouteStep that indicates a highway ramp’s signposted destination. (#63) - Added an
intersections
property to RouteStep that indicates the locations and configurations of each intersection along the step, including turn lane markings. (#80) - Added
UseLane
andTakeRotary
maneuver types, which indicate an instruction to change lanes or enter a large, named roundabout, respectively. (#93) - Fixed a crash that could occur when the user is connected to a captive network. (#71)
- Fixed a crash that occurred when a request failed due to rate limiting. (#103)
- The Route, RouteLeg, and RouteStep classes now conform to the NSSecureCoding protocol. (#68)
- Added convenience initializers to RouteLeg and RouteStep that accept a JSON dictionary formatted as the relevant part of a Mapbox Directions API response. (#92)
- The user agent string sent by the Mac version of this library now says “macOS” instead of “OS X”. (#55)
This is a complete rewrite of mapbox-directions-swift that focuses on making the API more Swift-like in Swift but also adds Objective-C support (#47). The goal is no longer to be a drop-in replacement for MapKit’s MKDirections API, but the library continues to use terminology familiar to Cocoa and Cocoa Touch developers. This version includes a number of breaking changes:
- Most types and methods can now be used in Objective-C.
- Removed the
MB
class prefix from Swift but kept it for Objective-C. If any type conflicts with a type in your application’s module, prefix it withMapboxDirections.
. - Added a shared (singleton)
Directions
object. Use the shared object if you’ve set your Mapbox access token in theMGLMapboxAccessToken
key of your application’s Info.plist file. (You may have already done so if you’ve installed the Mapbox iOS SDK or Mapbox OS X SDK.) Otherwise, create aDirections
object with the access token explicitly. - Simplified the networking part of the library:
- Removed the dependency on RequestKit. If you’re upgrading to this version using CocoaPods, you can remove the
NBNRequestKit
dependency override. Directions
no longer needs to be strongly held in order for the request to finish. Instead, the request is made against the shared URL session; to use a custom URL session, make the request yourself using the URL returned by theURLForCalculatingDirections(options:)
property.- A single directions object uses the shared URL session for all requests, so it can handle multiple requests concurrently without raising an exception.
- Removed the
cancel()
method; instead, directly cancel the NSURLSessionDataTask returned bycalculateDirections(options:completionHandler:)
.
- Removed the dependency on RequestKit. If you’re upgrading to this version using CocoaPods, you can remove the
- Replaced
calculateDirectionsWithCompletionHandler(_:completionHandler:)
andcalculateETAWithCompletionHandler(_:completionHandler:)
with a singlecalculateDirections(options:completionHandler:)
method, which takes aRouteOptions
object that supports all the options exposed by the Geocoding API. If you need to use Mapbox Directions API v4, use aRouteOptionsV4
instead ofRouteOptions
. - Steps are no longer returned by default, and the overview geometry is simplified by default. If you want full, turn-by-turn directions, configure the
RouteOptions
object to include the route steps and full-resolution route shapes. If you only want the estimated travel time or distance to a destination, use the default values inRouteOptions
. - Replaced the
MBDirectionsRequest.TransportType
type with a freeformprofileIdentifier
option. Use one of the three profile identifier constants with this option. - Removed the
MBDirectionsResponse
class in favor of passing the waypoints and routes from the response directly into the completion handler. - Renamed
Route.geometry
toRoute.coordinates
. For Objective-C compatibility, there are additional methods that work with C arrays of coordinates. - Each enumeration’s raw values are integer types instead of strings, but the enumerations also conform to
CustomStringConvertible
in Swift, allowing the enumeration values to be converted to and from strings easily.
Other changes since v0.5.0:
- Added official support for OS X, tvOS, and watchOS. (#49)
- Added documentation for the entire library. You can access the documentation for any symbol using Quick Help (option-click) or Jump to Definition (command-click). (#47)
- Replaced the
TakeRamp
maneuver type withTakeOnRamp
,TakeOffRamp
, andTurnAtRoundabout
to reflect changes in OSRM v5.1.0 and Mapbox Directions API v5. (#45) - Added options to configure what’s included in the output, how close the route needs to come to the specified waypoints, and whether to include routes that U-turn at intermediate waypoints. (#47)
- Added a way to specify the heading accuracy of any waypoint. (#47)
- By default, returned routes may U-turn at intermediate waypoints. (#47)
- Various error conditions returned by the API, such as the rate limiting error, cause the localized failure reason and recovery suggestion to be set in the NSError object that is passed into the completion handler. (#47)
- Requests sent through this library now use a more specific user agent string, so you can more easily identify this library on your Statistics page in Mapbox Studio. (#50)
- Updated Directions API v5 support to reflect late-breaking changes to the API. (#40)
- Distinguished between requested transport types and transport types in the response. Each route step in a returned route may have a different transport type. (#40)
- Route lines returned by the Directions API are now polyline-encoded instead of GeoJSON-encoded, so your application receives directions faster with less data usage (#27)
- Fixed a crash that occurred when encountering an unrecognized maneuver type from the Directions API. The API reserves the right to add new maneuver types at any time. Now unrecognized maneuver types resolve to
nil
. (#38) - Route summaries are synthesized on the client side when absent from routes returned from the server. (#40)
- A single MBDirections object can manage multiple concurrent requests.
cancel()
cancels all outstanding tasks. (#42)
- Added support for Mapbox Directions API v5. (#23, #25) Some highlights:
- An MBRoute now contains one or more MBRouteLegs, each of which contains one or more MBRouteSteps. A route leg connects two waypoints.
- The arrival step now announces the side of the street that contains the destination, if available.
- Specify an initial heading to avoid getting directions that begin opposite the current course.
- Start and end headings are provided for most steps.
- The library is now packaged as a dynamic framework, MapboxDirections.framework, rather than a collection of standalone Swift files. (#24)
- Added support for getting the estimated travel time to a destination. (#17)
- Added support for intermediate waypoints. (#16)
- Added support for specifying a custom profile identifier beyond the standard driving, biking, and walking profiles. (#15)
- An alternative route is no longer requested by default but can be requested by setting
MBDirectionsRequest.requestsAlternateRoutes
. (#19) - Fixed a crash that occurred when the departure step required a turn. (#24)
No notable changes.
No notable changes.
- Removed the use of SwiftyJSON.
- Updated the API endpoint URL. (#5)
Initial release.