What Kotlin Multiplatform is not

In the past few weeks of discussing Kotlin Multiplatform with a couple of people, I’ve discovered that there is a topic that seems confusing to people and that is, knowing how far you can go with Kotlin Multiplatform, what you can do with and what you cannot do with it, especially when it comes to Mobile development.

In a previous article, I discussed what Kotlin Multiplatform is and how to get started with it. In this article, I write shortly on what Kotlin Multiplatform is NOT.

Not the “cross-platform” you think

Before Kotlin Multiplatform Mobile was introduced, the idea of building cross-platform apps was with the use of tools/frameworks like Xamarin, Ionic, React Native, Flutter, etc to build applications that would run on Android, iOS, Windows, etc using the same single codebase. However, with KMM, you get to share a single codebase for your android and iOS apps’ business logic. You write platform-specific code where necessary, such as implementing native UI or when working with platform-specific APIs. So at the end of the day, the cross-platform benefit of KMM is not in you being able to write your mobile code once and deploy on multiple platforms, but you being able to write code that compiles to native binaries that can run without a virtual machine, thereby enabling you to share code among different platforms.

Common UI

I touched a bit of this in the first point above, as of today, KMM doesn’t give you the autonomy of sharing a common UI between different platforms. Instead, you build each platform’s UI using their native APIs and share common business logic. This implies, as an android dev, you may need to learn some Swift/iOS to get the iOS app done and vice-versa. Who knows, maybe KMM might enable us to share a common UI in the future.

New UI Process

Fine, you understand that you won’t be sharing a common UI when it comes to KMM, but you might be wondering if KMM has an influence on the process of building your UI or what method you use. I’m here to tell you that KMM does not. There is absolutely no new process to follow. You can build your UI using XML or Jetpack Compose for android, UIKit or SwiftUI for iOS.

Macbook compulsory?

While this is a valid point to consider, MacOS is however not a compulsory requirement for KMM. According to the doc, you can work on any computer with an operating system supported by Android Studio. The moment when MacOS comes to play is when you want to write iOS-specific code and run an iOS application on a simulated or real device. These steps cannot be performed on other operating systems, such as Microsoft Windows, due to Apple requirements. So, if you are in a team where you handle the android application in conjunction with the shared KMM code, you can successfully work on KMM using your Windows PC.

This is a short one, but I hope it helps to clarify some notions about KMM and help you understand it better.