-
Notifications
You must be signed in to change notification settings - Fork 318
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
Upgrade to post-Objective-C MapboxDirections.swift #2275
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the feedback below, please audit all other usage of the Polyline()
initializer. There are plenty of opportunities to eliminate excessive copying of coordinate arrays, for example here where routeLine
comes from a step’s shape
property, which is already a Polyline:
let polyline = Polyline(routeLine) |
|
||
extension Route { | ||
|
||
var json: String? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encoding as JSON is expensive enough that we probably shouldn’t hand-wave away the fact that this computed variable creates a new structure every time it is accessed. Instead, make it a method.
Once we implement mapbox/mapbox-directions-swift#391, the original JSON data can live alongside the decoded Route in a Response object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixture.swift and NavigationPlotter.swift (part of the TestHelper framework used in the test bundles and Bench) need some updates as well.
This PR blocks #2114: #2114 (comment). |
This comment has been minimized.
This comment has been minimized.
acfb7d7
to
4bffafd
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Rely on encoding and decoding to copy the object instead of manually copying each individual property, which is error-prone (and incomplete).
route-doubling-back.json was apparently generated with 5 digits of precision.
Coordinates are now round-tripped through Polyline encoding, so they get rounded to 5 or 6 places. What matters is that they’re still really close to the mark in terms of physical distances.
Build up a single attributed string as a container, embedding abbreviations in attributes.
8d12f8c
to
a5942cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All set now. We can expect the CocoaPods installation tests to continue to fail (due to linting errors) until we publish a final release of MapboxDirections.swift to CocoaPods trunk.
This PR is to track integration between #2230 (now merged) and mapbox/mapbox-directions-swift#382.
Burn-down list:
NSCoder
->Codable
refactoringsRouteOptions
Depends on mapbox/mapbox-directions-swift#393.
/cc @mapbox/navigation-ios