Why Kotlin Multiplatform could change everything in the mobile dev world
Tags: softwareengineering, thoughts, android, ios
Published: 2023-09-15 14:37:26

---
title: Why Kotlin Multiplatform could change everything in the mobile dev world
published: true
date: 2023-09-15 14:36:13 UTC
tags: Softwareengineering,Thoughts,Android,iOS
canonical_url: https://www.rockandnull.com/kotlin-multiplatform-compose-multiplatform-cross-platform-development/
---

 ![Why Kotlin Multiplatform could change everything in the mobile dev world](https://images.unsplash.com/photo-1556656793-08538906a9f8?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wxMTc3M3wwfDF8c2VhcmNofDM3fHxtb2JpbGV8ZW58MHx8fHwxNjk0Nzg4MjEzfDA&ixlib=rb-4.0.3&q=80&w=2000)

There have been countless approaches to cross-platform development over the years. A long time ago Java promised to "[write once, run everywhere](https://en.wikipedia.org/wiki/Write_once,_run_anywhere)". It's a promise that was mostly left unfulfilled.

Don't get me wrong, there are many respectable technologies out there that achieve this promise to a very decent degree in the mobile world.

Take for example [Flutter](https://flutter.dev/). In my opinion, the framework is as close to the cross-platform promise as any other. Literally, to add a new supported platform to the Flutter ecosystem, the Flutter team just needs to be able to draw to a canvas. This allows them to literally "write once, run everywhere". But even this approach of course has drawbacks. It's the same-looking app that runs on different platforms. On every platform, it feels "alien".

Other approaches, like [React Native](https://reactnative.dev/), choose to call native UI components to make the app feel "at home". Unfortunately, this has drawbacks as well. The complexity of the framework increases exponentially, and the framework team is in a constant catch-up race with the native platform while they are making changes to their native UI components, and subsequently breaking the cross-platform framework.

Now there's a new kid in town. [Kotlin Multiplatform (KMM)](https://kotlinlang.org/docs/multiplatform.html) - along with [Compose Multiplatform (CM)](https://www.jetbrains.com/lp/compose-multiplatform/) - promises to offer something that it has never been offered before in the cross-platform world (OK maybe it was tried [at least once](https://en.wikipedia.org/wiki/JavaOS) in the past). Up until this point, you could have good enough apps for every platform when using a cross-platform framework. If you wanted to have apps that feel "at home" you would have to take the native way. With KMM the promise is that you can have a native app in one of the major platforms (Android) and a good-enough app for the other major platform (iOS).

Also, the risk of adopting KMM+CM is significantly lower than any cross-platform technology. With Flutter, ReactNative, Xamarin, and others, if their maintainers decide one day that they no longer want to continue their development, you would be left in a messy situation where you would have to either re-write 2 native apps or choose another cross-platform framework (along with their different quirks). With KMM+CM, even if Jetbrain decides that this whole cross-platform experiment isn't worth it, your Android app would still be supported (since it's the official language and UI framework for Android).

Having shared my excitement for the Kotlin Multiplatform and the upcoming Compose Multiplatform technologies, I would need to note that both of these technologies are not marked as stable yet. KMM is almost stable, but for CM is still early days. But the potential is there. You might be able to write UI and business logic in Kotlin for your Android app, and easily port it to iOS to kick-start your app journey. When the app becomes big enough (and you choose so) you can write a native iOS UI and still share the business logic between the 2 apps.

Hopefully, what I described above could soon be a real-world scenario and not just daydreaming :)

Happy coding!