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

Discontinue Objective-C compatibility #381

Closed
1ec5 opened this issue Sep 16, 2019 · 4 comments · Fixed by #382
Closed

Discontinue Objective-C compatibility #381

1ec5 opened this issue Sep 16, 2019 · 4 comments · Fixed by #382
Labels
backwards incompatible changes that break backwards compatibility of public API objective-c
Milestone

Comments

@1ec5
Copy link
Contributor

1ec5 commented Sep 16, 2019

We’re discontinuing support for applications written purely in Objective-C to use the iOS navigation SDK. The same change will take place in the iOS navigation SDK: mapbox/mapbox-navigation-ios#2231. Applications written in Objective-C will need to implement compatibility shims in Swift to continue to interoperate with this library.

Since #47, we’ve half-heartedly supported Objective-C by ensuring bridgeability of key APIs, but there are many gaps in coverage, and the public API in Objective-C feels like a translation from another language. A renewed focus on Swift will eliminate a major source of technical debt. We’ll be able to write more idiomatic, less error-prone Swift code without compromising the developer experience in both languages.

Discontinuing Objective-C support will have the following immediate impacts on the codebase:

  • @objc attributes and MB class prefixes will disappear.
  • Methods whose sole purpose is to bridge to Objective-C will disappear.
  • Enumeration declarations will move from Objective-C headers to Swift files.
  • The CMapboxDirections target will be removed from the SPM distribution.
  • References to Objective-C compatibility will be removed from readmes and jazzy guides.

We’ll hopefully be able to take advantage of some Swift language features in the process:

  • Convert value classes to structures or enumerations with associated types.
  • Convert abstract classes to protocols with default implementations.
  • Move global constants under structures and classes.
  • Replace magic default values with optionals.
  • Replace NSCoding with Codable.

/cc @mapbox/navigation-ios

@1ec5 1ec5 added objective-c backwards incompatible changes that break backwards compatibility of public API labels Sep 16, 2019
@1ec5 1ec5 added this to the v0.31.0 milestone Sep 16, 2019
@1ec5
Copy link
Contributor Author

1ec5 commented Sep 27, 2019

Work is happening in #382.

@1ec5
Copy link
Contributor Author

1ec5 commented Oct 30, 2019

mapbox/mapbox-speech-swift#31 removes Objective-C support as well.

@1ec5
Copy link
Contributor Author

1ec5 commented Dec 7, 2019

Tail work is being tracked in the following issues:

@1ec5 1ec5 closed this as completed in #382 Dec 11, 2019
@1ec5 1ec5 modified the milestones: v0.31.0, v1.0 Dec 28, 2019
@1ec5 1ec5 pinned this issue Jan 21, 2020
@1ec5
Copy link
Contributor Author

1ec5 commented Mar 3, 2020

If your application is written in Objective-C, the changes in v1.0.0-alpha.1 don’t mean you have to rewrite your application in Swift, though you’re certainly free to do so. But you would at a minimum need to write a compatibility shim around the parts of MapboxDirections’ public API that your application uses. If you use the navigation SDK, mapbox/mapbox-navigation-ios#2231 (comment) has an example compatibility shim that you can adapt for your needs.

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 objective-c
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant