Hey folks, how are you all handling resources in a...
# multiplatform
m
Hey folks, how are you all handling resources in a multi-platform world? For example, on Android we would normally have a R class with all resources but that would be a problem to share them with Desktop and iOS apps... Any resource (links, good tutorials, GitHub with code...) Is welcomed! Thank you in advance! šŸ¤”
w
Here we use https://github.com/icerockdev/moko-resources so far works fine, we share Strings and PNGs from Shared code to Android and iOS - KMM project, not sure if would work with Desktop too šŸ¤”
šŸ‘ 1
a
it does seem to have some support for jvm and macos which is nice, but no js unforutnately I'm looking forward to the feature announced at the premier event where downstream consumers can define `actual`s for unsupported platforms. I think it was something like `external expect`s?
m
We used Square’s KotlinPoet to generate our own colors and locales from flat files.
It was pretty simple to do and less complicated than moko-resources
There’s not a whole lot of value in sharing images as they are different files (PDF vs SVG), so that’s pretty irrelevant.
šŸ‘ 1
w
Agreed, we don’t share when it is PDF/SVG šŸ˜ž Currently approach is to have an
enum
ā€œrepresentingā€ the icon and the view resolves it to the native icon. BUT we also use some PNGs, which moko-resource is fine to share. Also we share directly as
String
, our shared classes resolve (via some extensions) from the
StringDesc
to
String
.