Hello. Which is better for Kotlin Multiplatform- J...
# multiplatform
h
Hello. Which is better for Kotlin Multiplatform- Jetpack Compose or XML UIs?
c
kotlin multiplatform is "bring your own ui toolkit" and so you can use whatever you want on that platform (while still sharing business logic, networking code, persistence layer, etc) if you want multiplatform uis, then you want compose multiplatform, which means compose is whatd you use.
a
Both are good. However with JPCompose you will have more flexibility since it is also being actively developed for common target in multiplatform aka shared code.
c
for example. this is kotlin multiplatform. the "view" is whatever you want. but you have to build it for each platform. compose multiplatform "solves" the ui piece there.
m
From an ideal standing point, it would be easier to use compose, since it can be written in the common source set. Realistically, you will likely need some traditional java views, which can be generated with code or through inflation, since more complex stuff like maps or camera access is still not being solved directly with compose.
j
Also Compose has interop with XML/Java View, so can mix it however you want :)
c
Yep, and compose has interop with swiftUi too. I would probably just go to kmp.jetbrains.com and select a compose android + ios app and go forward from there. i just wanted to highlight the differences between kmp and kmp compose.
h
Do Jetpack Compose and XML UIs work on IOS properly if Kotlin Multiplatform is used?
j
No you cant use Android specific Views (XML) in iOS. They only work in Android. You can use Compose mixed with UiKit, SwitftUi etc in iOS though 🙂
j
We have a proprietary solution that actually allows you to use the Android specific Views (XMLs) on iOS; no Compose, just recompile the Android stuff for iOS using KMP. Please message me privately if you are interested.