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
14.85k stars 1.08k forks source link

Compose resources do not work on iOS with multi-module structure #4717

Closed H4kt closed 2 weeks ago

H4kt commented 2 weeks ago

Describe the bug Compose is not merging resources from different modules included as dependencies. This might be more of a question type of issue, however it works just fine for Android. There might be a need to manually configure copying of the resources. If so, how could this be done with the example project structure?

Affected platforms

Versions

To Reproduce

  1. Create a multi-module project Sample structure:
    • /composeApp
      • /app (includes all the features via project(":composeApp:features:..."))
      • /features/splash (has some text resources)
  2. Run the app on an iOS device

Expected behavior String resources should load just like on the Android target

Actual behavior App crashes with

Uncaught Kotlin exception: org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: values/strings.xml
iruizmar commented 2 weeks ago

Hey!

Multi-module resources are not supported in Compose 1.6.2.: Multimodule projects are generally not supported yet: https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-images-resources.html

You should be using 1.6.10-* and Kotlin 2.0.0: https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.6.10-beta01

H4kt commented 2 weeks ago

Thank you for pointing this out.

Tested with: Kotlin 2.0.0-Beta5 Compose Multiplatform 1.6.10-beta01, 1.6.10-beta02, 1.6.10-dev1608

The issue persists

igordmn commented 2 weeks ago

Could you attach a minimized project, in which you experience the issue? Multi-module support should be available since 1.6.10-beta01 + Kotlin 2.0.0-Beta5

H4kt commented 2 weeks ago

This happened to be a misconfiguration of the XCode project. It seems like Fleet wrecked something up.

Fixed by replacing iosApp folder with a generated one from the project wizard.