What's the latest on how one can publish an xcfram...
# compose
s
What's the latest on how one can publish an xcframework for others to consume while containing CMP code with resources like font files? Building locally through
embedAndSignAppleFrameworkForXcode
works just fine on the project consuming the shared code, however when publishing the xcframework to a GitHub release and then bringing the dependency to the iOS codebase we get an error like
Copy code
org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: ..../private/var/containers/Bundle/Application/.../....app/compose-resources/composeResources/.../font/custom_font.otf
but I've been unable to find a way to fix this issue
For reference, these are the publications of the shared code here https://github.com/HedvigInsurance/umbrella/releases
This seems to imply that this should "just work™️" https://github.com/JetBrains/compose-multiplatform/pull/5294 blob shrug
@Konstantin Tskhovrebov Seeing as you are the author of this PR I hope you don't mind the poke here. In our setup where we have a ":resources" gradle project, and an ":umbrella" gradle project which exports this resource project along with itself (and others) I am simply unable to find a way to make it work. When trying to use it "locally" on a sample project using
embedAndSignAppleFrameworkForXcode
it seems to work fine fwiw. When exporting it by doing
assemble<<NAME>>ReleaseXCFramework
and then zipping and uploading the XCFramework to a GitHub release then we get the error mentioned above. Are there extra steps required to make it work in this scenario? Because I have been unable to find something in the documentation so far.
Everything I find online seems to just points towards "it should just work" 😅 https://kotlinlang.org/docs/multiplatform/whats-new-compose-180.html#compose-resources-in-xcframeworks
k
yes, it should just works. and we have a test case for that: https://github.com/JetBrains/compose-multiplatform/blob/a81270f67db2c04138f0f5540f[…]n/org/jetbrains/compose/test/tests/integration/ResourcesTest.kt if it doesn't then we need a reproducer project and youtrack issue, please
s
Are there docs around setting this particular thing up perhaps? I fear I am just misconfiguring this somehow, yet I feel like I've done everything I've seen that should be done. I guess I can look into the
fullTargetsAppWithResources
project that the test also uses to see how mine differs
k
1. check your xcframework's content and find resource files there 2. if it contains everything then the problem in your xcode project
if not, then in the kotlin project build
s
Yeah you are right. Inside the generated framework I do see:
Copy code
HedvigShared.framework >
| > composeResources
| | > hedvig.resources
| | | > drawable
| | | > font
| | | > values
| | | > values-sv-rSE
| | > othermodules...
| > Headers
| > Modules
| > ...
So that part should be working fine after all. So I suppose it should be on the other end. More specifically, on the iOS side the error says:
Copy code
org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: /private/var/containers/Bundle/Application/A2D702C1-FA2D-547F-9C7A-ECB6E2754D17/Ugglan.app/compose-resources/composeResources/hedvig.resources/values/strings.commonMain.cvr
Do you know if there's a way for me to debug it on the other end too, to try to look inside the generated file on the iOS side and see what exists inside the path that it's trying to look at?
While writing this, I did manage to get this to work properly on an ipad running os version 18.5 instead of 26.x Without doing any other changes as far as I can tell
Anyway, maybe I'm using some older version which doesn't support the 26 target yet. Thanks a lot for the pointers. I didn't know I could just look inside the framework to find the resources or not, as silly as that sounds in hindsight
Yeah tested a bit again today and running on a real device running iOS 16 it simply crashes with not finding the resource. On a simulator running iOS 18.5 it just worked no problem at all 🤷