KMM or CMM? That is the Question
Over the past year I've made quite a few apps using kotlin multiplatform (KMM), but recently I used compose multiplatform (CMM). I want to talk about my feels for both and which I think you should use.
What is KMM?
KM is a way to write common backend/bridge to backend code for Android and iOS. My last published app using KMM is My Car and the one in test is Pet Log (all coding is on pause).
The limits found in KMM is that you can't use 1 UI for both platforms. Luckily Jetpack Compose and Swift UI are pretty close but we want that real multiplatform, write once and see everywhere feel. I guess the solution to this problem is CMM.
What is CMM?
I just want to say that honestly this is a very good question because the way you read about KMM there shouldn't be a need for KMM. Essentially these should be the same thing but they aren't quite.
CMM is use to share UI across platforms. The biggest change is seen in the folder structure/ structuring of code. It still uses KMM under the hood with shared code in "common main".
I'll let you know know that it wasn't all that smooth to switch from KMM to CMM. It took a few days to figure out how to gte things to match. There should be a tool that moves things around for you. Also my biggest gripe about CMM is that they haven't worked on a way to use native compose navigation. Why make a shared UI platform public without that extremely important piece. I know people like 3rd party apps and that's fair, BUT if I was porting my app over there shouldn't be a problem of me rewriting my entire navigation. That's actually kinda crazy.
All in all I don't think I really like CMM right now. I have a flutter app I was porting over to KMM and I think I'll keep it there even if Android and iOS take two different UI files. It's just safer right now until there is a better "native" navigation solution I think.
So what should I use?
If your looking for a true multiplatform feel I think you should go with CMM long term. You will get both mobile app platforms and desktop. I can't say that I see this lasting long term at this point in time. I'm usually pretty good at noticing trends ( I think) and as a UI options this doesn't feel like a good workflow.
If you want to just use "kotlin all the things" for backend then KMM is as good as it's going to get. My friend Joe is usually a .NET guy and he seemed to really enjoy kotlin for backend coding which was really cool because I felt like we had more backened and frontend cross-help more.
TLDR on my opinions
- KMM is really cool to have a shared code base across all teams
- CMM has no navigations so not a real multiplatform solution to me
- I won't be making anymore apps in CMM
- Kotlin all the things!!
P.S.
I want to take this space to say to Google and Jetbrains...I use your products a lot to manage my apps. I want better documentation all around and I promise I'll help to get this moved further.