rickclephas / KMP-NativeCoroutines

Library to use Kotlin Coroutines from Swift code in KMP apps
MIT License
1.07k stars 32 forks source link

@OptIn is included into generated Native classes and breaks iOS builds #111

Closed hrodrick closed 1 year ago

hrodrick commented 1 year ago

We are having an issue when trying to use the app that was built for iOS, we couldn't compile it on XCode if one of our @NativeCouroutines annotated methods contained an @OptIn annotation.

Since the library is open source too, you should be able to reproduce it easily on this branch

Migration steps on the iOS side are not complete yet, but by removing the @OptIn annotations from this file the error dissapears and we can continue with the migration steps on iOS.

However, when generating the Native version of the FlowForm file, it shouldn't copy the @OptIn annotations, or if it should then it shouldn't affect the iOS build on Xcode.

rickclephas commented 1 year ago

Thanks for the report! Depending on your code (e.g. when the return type needs an opt-in) the @OptIn annotations might be needed on the native declaration as well, which is why it's always added.

However there indeed seems to be some issue with the generated code. I will take a look at that.

rickclephas commented 1 year ago

FYI this should be fixed in v1.0.0-ALPHA-9.

hrodrick commented 1 year ago

Ey thank you for the quick fix! Highly appreciated