Upgrade to post-Objective-C MapboxDirections.swift#2275
Conversation
1ec5
left a comment
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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.
|
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
1ec5
left a comment
There was a problem hiding this comment.
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->CodablerefactoringsRouteOptionsDepends on mapbox/mapbox-directions-swift#393.
/cc @mapbox/navigation-ios