Skip to content

Commit

Permalink
Merge pull request #297 from mapbox/return-response
Browse files Browse the repository at this point in the history
Directions response JSON is now included in the `DirectionsResult` object
  • Loading branch information
akitchen committed Oct 1, 2018
2 parents b6bd5b1 + 649017f commit 5e81476
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes to the Mapbox Directions SDK for iOS

## master

* `DirectionsResult` now includes the API response as JSON

## v0.23.0

* Added `Waypoint.allowsArrivingOnOppositeSide` property for restricting the side of arrival. ([#288](https://github.com/mapbox/MapboxDirections.swift/pull/288))
Expand Down
5 changes: 4 additions & 1 deletion MapboxDirections/MBDirectionsResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import Polyline
@objc(MBDirectionsResult)
open class DirectionsResult: NSObject, NSSecureCoding {

@objc internal init(legs: [RouteLeg], distance: CLLocationDistance, expectedTravelTime: TimeInterval, coordinates: [CLLocationCoordinate2D]?, speechLocale: Locale?, options: DirectionsOptions) {
public var json: [String: Any]?

@objc internal init(json: [String: Any]? = nil, legs: [RouteLeg], distance: CLLocationDistance, expectedTravelTime: TimeInterval, coordinates: [CLLocationCoordinate2D]?, speechLocale: Locale?, options: DirectionsOptions) {
self.json = json
self.directionsOptions = options
self.legs = legs
self.distance = distance
Expand Down
6 changes: 3 additions & 3 deletions MapboxDirections/MBRoute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import Polyline
open class Route: DirectionsResult {
// MARK: Creating a Route

@objc internal override init(legs: [RouteLeg], distance: CLLocationDistance, expectedTravelTime: TimeInterval, coordinates: [CLLocationCoordinate2D]?, speechLocale: Locale?, options: DirectionsOptions) {
super.init(legs: legs, distance: distance, expectedTravelTime: expectedTravelTime, coordinates: coordinates, speechLocale: speechLocale, options: options)
@objc internal override init(json: [String : Any]? = nil, legs: [RouteLeg], distance: CLLocationDistance, expectedTravelTime: TimeInterval, coordinates: [CLLocationCoordinate2D]?, speechLocale: Locale?, options: DirectionsOptions) {
super.init(json: json, legs: legs, distance: distance, expectedTravelTime: expectedTravelTime, coordinates: coordinates, speechLocale: speechLocale, options: options)
}

/**
Expand Down Expand Up @@ -40,7 +40,7 @@ open class Route: DirectionsResult {
speechLocale = Locale(identifier: locale)
}

super.init(legs: legs, distance: distance, expectedTravelTime: expectedTravelTime, coordinates: coordinates, speechLocale: speechLocale, options: options)
super.init(json: json, legs: legs, distance: distance, expectedTravelTime: expectedTravelTime, coordinates: coordinates, speechLocale: speechLocale, options: options)
}

public var routeOptions: RouteOptions {
Expand Down

0 comments on commit 5e81476

Please sign in to comment.