JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.96k stars 1.16k forks source link

Can't access exposed resource from core module (iOS) #4392

Closed mpierucci closed 6 months ago

mpierucci commented 6 months ago

Describe the bug In order to bypass the current limitation of multi modules ntonotsupported, we add all the resources in a core module and then expose them through composable functions. This works as expected on Android, but on iOS we get the exception: org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: values/strings.xml Reproducer Project

Affected platforms

Versions

To Reproduce Steps and/or the code snippet to reproduce the behavior:

  1. Clone the provided reproducer project
  2. Run the iOS App
  3. Click on "Click me!" Button
  4. See error

Expected behavior The app should not crash on iOS and the resource should be shown.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Note that the reproducer project was created with the late wizard and was only modified to expose the resources from a resource module. Running the android app does not have any issues

terrakok commented 6 months ago

In order to bypass the current limitation of multi modules ntonotsupported, we add all the resources in a core module and then expose them through composable functions.

resources must be in the top level app module

terrakok commented 6 months ago

https://github.com/JetBrains/compose-multiplatform/issues/4229

mpierucci commented 6 months ago

In order to bypass the current limitation of multi modules ntonotsupported, we add all the resources in a core module and then expose them through composable functions.

resources must be in the top level app module

Does that means that is there no work around at all for project with feature modules? Essentially not being able to use the library at all?

If so is there a rough estimate on when would that be possible? ( Just to decide if we can wait or we should pick another library)

Also why does it works on Android builds?

terrakok commented 6 months ago

The first dev builds will be available soon but it will rtequire the kotlin gradle plugin 2.0+

It doesn't work as you expected on the android target. JVM ecosystem has binary for each module (jars) and it supports resources. Kotlin ecosystem doesn't have a resources support yet.

okushnikov commented 2 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.