So I wanted to play with Compose in iOS by buildin...
# compose-ios
t
So I wanted to play with Compose in iOS by building it into my existing KMP module, which currently is configured for Android, iOS, macOS, watchOS (with darwin and jvm configured as parent targets as well). If I include the compose modules in common, then gradle sync fails since there appear to be no artifacts for the watchos targets. So then i tried to adjust my hierarchy like so: • common ◦ darwin ▪︎ composable • ios • macos ◦ watchos but when i try to build I get this error on the compile for all watchos targets:
Compilation failed: Cannot find the Composer class in the classpath
So, any way I get this working? Since the app I want to build with has a watchos extension I cannot easily remove or disable... Thank you!
d
Hello! It is possible to create another gradle module only with Compose Multiplatform and use it in your watchOS + iOS gradle module only on iosMain sourceSet with implementation(":my-compose-module").
t
Okay, I will give that a look, thank you!
l
As of right now, the compose runtime needs to be added as a dependency to all source sets in a module that uses the compose plugin. You can make a separate module for the compose targets as already mentioned, or you could add the runtime as a dependency to all source sets if you want just one module.
t
i think I tried the latter, but since it appears there is no watchos support, the build fails that way. I am looking into how to add a sibling module/project now.
or are you suggesting it might build if i include just compose-runtime in the watchos target?
l
You'd just need the runtime. In general the multimodule solution is better, but if you needed single module for some reason, you can just add the runtime dependency. I think it supports all targets now.
t
okay, i looked at the maven artifacts, and as you say the runtime is build for all targets. the issue then is that in order to put the composable in common, i need foundation and material(3) there too, which then will not build with watchos active. for now i am disabling watchos just to get something built. then i will look again at a seperate module (unless the next 1.4.1 version fixes everything for me 🙂 )
l
The runtime won't bring support for UI. That will have to be added by the JB team. Right now, only Android, Desktop (jvm), and Web (DOM) are stable, then iOS is in alpha, and Web (Canvas) and macos (native) are experimental. No support for tvos, watchos, windows (native), or linux (native).
t
understood. thanks! so far i am impressed at how much of compose code just works...