Hello! I’m curious about the progress of Compose M...
# compose
g
Hello! I’m curious about the progress of Compose Multiplatform resources multi-module projects support. Do you know where I can follow updates on this? Thanks!
m
I guess the #announcements will be a good starting point. My current experience: it works in multi module projects, as long as you store all resources in the main module. I have a
resource
module with a
ResourceProvider
interface. That interface defines all available drawables/strings etc and is injected into all modules with koin. In my composeApp di module i provide a real implementation of this interface and map the Res.drawable/Res.strings to my interface fields. It’s not ideal, but also not a deal breaker for multi module projects imho.
g
Hello Max and thanks for your response. Actually, the only reason that made me use composeResources was the fact that providing fonts to Wasm was not trivial as for android, iOS and Desktop. The drawback is - for now - that I cannot have my project structured like this:
Screenshot 2024-04-15 at 12.44.27.png
since AndroidApp and browserApp will complain about not finding resources. That’s why for those targets I’m doing this:
Screenshot 2024-04-15 at 12.45.46.png
and to run Android (
./gradlew :shared-ui:main:installDebug
) or Wasm (
./gradlew :shared-ui:wasmJsBrowserDevelopmentRun
) I must use this targets.
It’s ok, but for me not ideal
I don’t like the Idea of having a composeApp module with all the targets inside. I prefer to have a shared-ui module, and then a module for each target that wants to consume it
(desktopApp seams to have no problem with this approach)
fixed my problems 🎉