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

Migrate from Objective-C++ to pure Swift #122

Open
alex-vasenin opened this issue Jul 14, 2024 · 1 comment
Open

Migrate from Objective-C++ to pure Swift #122

alex-vasenin opened this issue Jul 14, 2024 · 1 comment

Comments

@alex-vasenin
Copy link
Contributor

Swift 5.9 introduced direct interoperability with C++ without relying on Objective-C as a bridge. That means that we can get rid of Objective-C wrappers and improve performance a bit. Backward compatibility isn't much of problem, since starting from 29.04.2024 apps uploaded to the App Store must be build with Xcode 15.

@alex-vasenin
Copy link
Contributor Author

I tried to port CAARiseTransitSet2 to SwiftAA using native C++ interoperability and I think it's not ready for production.

First, at the moment if one of your dependencies needs cxx-interop you must enable it for entire project (see swiftlang/swift#66156).

Second, enabling cxx-interop for existing project is potentially a code-breaking change. Specifically, in SwiftAA I have to make one testing function which returns Never private because it produces an error in generated SwiftAA-Swift.h file. Another similar error in this file is that compiler can't find definitions of UIColor/NSColor and CLLocation classes (I have to resort to ObjC-style forward-declaring them in one of the header, but it didn't work on the client).

And the third thing is enabling cxx-interop increases compilation duration 3-4 times. Considering one have to enable interop for entire project it's a deal breaker.

The results are here (it's not finished, some headers and ObjC forward declarations are missing from produced framework)

I hope the situation will improve in future.

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

No branches or pull requests

1 participant