Is there any special setup needed for compose reso...
# compose-ios
e
Is there any special setup needed for compose resources in an ios app from a multi module project? All other targets (Android, JVM, wasmJs) work, but on ios I get the following crash:
Copy code
Uncaught Kotlin exception: org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: /Users/eli/Library/Developer/CoreSimulator/Devices/9660704F-3B99-49B1-84BC-0E273CE826CA/data/Containers/Bundle/Application/2567FE4E-6D7F-4D36-ABF0-6CEE36EF6F05/MyApp.app/compose-resources/composeResources/com.myapp.design.material.theme/font/source_sans_pro_regular.ttf
where the font resources are in a module
:design:material:theme
.
b
The fonts need to be in shared/src/commonMain/composeResources/font Then you can access them like Res.font.font_name and they should work everywhere There's also a tiny setup mentioned in the docs https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-multiplatform-resources-setup.html#custom-resource-directories
e
Looks like it's a different issue, which is that resources and XCFramework don't work well together. There's a workaround, but it isn't the greatest - https://youtrack.jetbrains.com/issue/KT-66790
b
I'm just building a normal app and the docs work, I guess that doesn't require whatever XCFramework is breaking then?
e
All of the ios related things are magic to me currently ¯\_(ツ)_/¯
b
are you just doing a normal app though or are you trying to export something special?
But I feel ya on that as well lol
e
I have multiple modules, with a an
ios-framework
module that acts as an umbrella to create an XCFramework, and then a regular ios project that uses that XCFramework
b
More magic than I've done then... I guess that's the problem
m
Compose resources cannot be exported with the xcframework, take a look at Moko Resources instead, that works fine with generating a framework and sharing the resources!
e
Interesting @Konstantin Tskhovrebov can compose resources do whatever Moko resources is doing to support use with an xcframework?
m
Open issue here (although I see you already commented there @eygraber)
a
Arf, I wish I would have found this discussion before I began my 1.7 migration. I got all the way through making my multimodule app work on Android only to discover things just don't work at all on iOS 🤦
Update: I was able to get my XCFramework multi-module app working by just re-copying all the assets back into the Shared module resources folder. I had Claude generate a script that does this for me, which I'll attach here. With this, per-module generated Res files still work on iOS and Android
👍 1
v
So we really can't currently have compose-resources in a different from shared/composeApp module and there is no way to export them to the ios framework? Wouldn't export(projects.design.materialtheme) do the trick? UPD: Yea resources actually doesn't support multi module project. I wish that limitation was mentioned anywhere in the docs.