Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed access level of MBRouteOptions response function & MBRouteStep instructions parameter #246

Closed
wants to merge 1 commit into from

Conversation

wishtrip-dev
Copy link

  • Changed access level for response(from json: JSONDictionary) function from internal to public

Our backend, similar to Mapbox backend, can create Routes to navigate. Accordingly, we are interested that the method responsible for parsing route JSON file should be public, because we receive the route JSON file from our server outside of the Mapbox framework.

  • instructions parameter changed from let to var

Several of our custom routes have special instructions, which cannot be loaded while creating Route objects. We would like MBRouteStep's instructions parameter to be declared as a variable, allowing it to be changed dynamically after the Route object is created.

We believe these changes will be useful for other customers of MapboxDirections.swift.

- Instructions changed from let to var
@frederoni
Copy link
Contributor

Thanks for the PR.
In order to make it build and pass on CI

  • Change the RouteOptions.response(from:) signature to take a [String: Any]. (We could make the typealias JSONDictionary public but I don't think MapboxDirections should be in the business of defining what a json dictionary is.
  • Change the access level of RouteOptionsV4.response(from:) to public.

@wishtrip-dev
Copy link
Author

A better solution was found (i.e. using Route.init(json:waypoints:routeOptions:) to create Route object from custom route JSON). There's no need for pull request.

@gregoireLem
Copy link

gregoireLem commented Mar 13, 2018

@wishtrip-dev do you have an exemple on how you created/parse your objects required in Route.init ?

I have an error : Unexpectedly found nil while unwrapping an Optional value in RouteStep.init(json:) when calling Route.init ..

thx

@1ec5
Copy link
Contributor

1ec5 commented Mar 15, 2018

RouteStep(json:) expects a JSON-serializable object that matches the Mapbox Directions API’s documented response format. #198 would add a convenience layer for custom OSRM instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants