-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Failing to use Compose runtime in common code targeting native #2346
Comments
Possible related to #2342 |
I'm getting the exact same issue. Just adding |
Can you please try version 1.3.0-alpha01-dev849 and add to gradle.properties: |
I fixed my issue by making the |
I'm also getting this issue, which was also fixed by marking my composable internal! |
@dima-avdeev-jb, I'm understanding that it's not currently possible to make a Composable function public in common code while targeting native. This is blocking us from being able to modularize the code with Composables, and most importantly being able to incrementally migrate Android logic into shared code base incrementally. Is there a fix for this in some dev release, and if not, would you have an estimate for when this is planned to be fixed? |
@kirillzh Yes, you can't use public Composable functions in iOS for now. |
@kirillzh Except for the composable function of the module finally used in iOS, it is okay to use the public composable function. For example, I use feature-wise modular like below graph TD;
A[feature1] --> |Public Composable function| C[presentation]
B[feature2] --> |Public Composable function| C
C --> |Internal Composable function| D[iosApp]
In this case, public composable functions in feature1 and feature2 are available. |
Hi @TaehoonLeee, could you share a simple example of what you described. I tried on my side and still no way to expose a Composable in iOS target. |
It is impossible to use composable functions directly on iOS target. Therefore, all the composable functions in the module exported to the iOS target must be specified as internal. However, the composable functions in other modules may be public. Using this point, it seems possible to modularize composable function. https://github.com/TaehoonLeee/multi-module-clean-architecture/tree/multi-platform In above project the iOS app uses presentation module only. My English is limited. I ask for your understanding. |
@TaehoonLeee , |
Do we know if this is resolved by compose compiler 1.4.0 and Kotlin 1.8.20? I'm seeing similar mentions in other related issues such as #2901 (comment) |
Yeup, got fixed in 1.4.0 |
Wohoo! |
Fixed in Compose 1.4.0 |
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
Failing to compile simple Compose function targeting native code (iOS
iosX64
oriosArm64
).Kotlin
1.7.10
Jetbrains Compose
1.2.0-beta01
Compose compiler
1.3.0
Repo code is in this branch: https://github.com/kirillzh/kmm-production-sample/tree/common-compose.
Error:
Full Error
Moving Composable function under a class/interface, gives a bit different error:
Error:
The text was updated successfully, but these errors were encountered: