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

Upgrade to post-Objective-C MapboxDirections.swift #2275

Merged
merged 39 commits into from
Dec 26, 2019
Merged

Conversation

JThramer
Copy link
Contributor

@JThramer JThramer commented Nov 25, 2019

This PR is to track integration between #2230 (now merged) and mapbox/mapbox-directions-swift#382.

Burn-down list:

  • Fix error issues
  • JSON Passthrough
  • NSCoder -> Codable refactorings
  • copy constructor for RouteOptions

Depends on mapbox/mapbox-directions-swift#393.

/cc @mapbox/navigation-ios

@JThramer JThramer added op-ex Refactoring, Tech Debt or any other operational excellence work. topic: directions backwards incompatible changes that break backwards compatibility of public API labels Nov 25, 2019
@JThramer JThramer added this to the v1.0.0 milestone Nov 25, 2019
@JThramer JThramer self-assigned this Nov 25, 2019
Copy link
Contributor

@1ec5 1ec5 left a 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:

MapboxCoreNavigation/CLLocation.swift Outdated Show resolved Hide resolved
MapboxCoreNavigation/CLLocation.swift Outdated Show resolved Hide resolved
MapboxCoreNavigation/CoreFeedbackEvent.swift Show resolved Hide resolved
MapboxCoreNavigation/EventDetails.swift Outdated Show resolved Hide resolved
MapboxCoreNavigation/EventDetails.swift Outdated Show resolved Hide resolved
MapboxCoreNavigation/RouteController.swift Show resolved Hide resolved
MapboxCoreNavigation/RouteLeg.swift Outdated Show resolved Hide resolved
MapboxCoreNavigation/RouteOptions.swift Outdated Show resolved Hide resolved
MapboxCoreNavigation/RouteProgress.swift Outdated Show resolved Hide resolved
MapboxCoreNavigation/SimulatedLocationManager.swift Outdated Show resolved Hide resolved
MapboxCoreNavigation/RouteOptions.swift Outdated Show resolved Hide resolved

extension Route {

var json: String? {
Copy link
Contributor

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.

MapboxCoreNavigation/RouteProgress.swift Outdated Show resolved Hide resolved
MapboxNavigation/InstructionPresenter.swift Outdated Show resolved Hide resolved
MapboxNavigation/LaneView.swift Outdated Show resolved Hide resolved
Copy link
Contributor

@1ec5 1ec5 left a 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.

@1ec5
Copy link
Contributor

1ec5 commented Dec 21, 2019

This PR blocks #2114: #2114 (comment).

@1ec5

This comment has been minimized.

@1ec5 1ec5 self-assigned this Dec 21, 2019
@1ec5 1ec5 marked this pull request as ready for review December 21, 2019 20:36
@1ec5 1ec5 changed the title OBJ-C Obsoletion Integration Upgrade to post-Objective-C MapboxDirections.swift Dec 21, 2019
@1ec5

This comment has been minimized.

@1ec5

This comment has been minimized.

@1ec5

This comment has been minimized.

@1ec5

This comment has been minimized.

@1ec5

This comment has been minimized.

@1ec5

This comment has been minimized.

@1ec5

This comment has been minimized.

@1ec5

This comment has been minimized.

@JThramer

This comment has been minimized.

@1ec5

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.
Copy link
Contributor

@1ec5 1ec5 left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards incompatible changes that break backwards compatibility of public API op-ex Refactoring, Tech Debt or any other operational excellence work. topic: directions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants