Hello guys, would like to ask how you share resour...
# multiplatform
l
Hello guys, would like to ask how you share resources, especially texts and drawables in kotlin multiplatform project with swiftUI layer for ios. Compose resources could generate resources to multiplatform purposes but how to use them in swiftUI?
f
l
thank you to reply i guess there is no universal solution to support multiplatform project like following: monorepo contains composable common code, android compose, ios swiftUI AND ios compose (means two ios apps, one made with swiftUI, second with jatpack compose) where drawables could not be duplicated in more folders, means keep one source of truth
f
Yes you can do that approach
you can create a shared module (shared with a CMP app and/or SwiftUI app). You shared module can contains the viewmodel, the one from CMP not from Android.
also, you can create a dedicated module with inside your resource with moko which can be exported to you SwiftUI app
a lot of thing is possible but require some skills with Gradle and Xcode 😄
l
I have more gradle modules, where drawables are places so there should be always applied composable resource AND moko resources at the same time? Means composable resource could read custom directory to generate Res file that could be used in composables and moko read moko-resources that will be used for swifUI am i right @François? thank you to taking care of me 🙂
f
so there should be always applied composable resource AND moko resources at the same time?
Use only one solution, preferably, using both will add complexity and increase build time.
Moko is compatible with CMP and Native, it’s a good alternative
if you want to use both, separate properly your ressources to avoid replicated code.
FYI: https://klibs.io/?query=resources for alternative to moko
l
does compose coil supports to load moko resources? cannot find this information
i know that coil accept any as data resource, but it is any 😄
f
Coil is for remote image, right? compose/moko resource is for local image