Kotlin Multiplatform

visit website

Kotlin Multiplatform (KMP) is the ability to write pure Kotlin code (meaning having no platform specific code in it), combined with platform-specific Kotlin code, and run this on multiple platforms. This is done with the help of Kotlin/JVM to target JVM platforms (like Android), Kotlin/Native to target native platforms (using a LLVM backend, targetting platform like iOS, macOS, Windows,..), and Kotlin/JS to use in javascript codebases.

We already know from tools like Flutter and React that using the same language for multiple platforms is a big advantage. One of the disadvantages of these tools is that combining them with native code isn't that easy. Since Kotlin compiles/transpiles to actual native code, interop is as easy as mixing Kotlin with Java on Android.
Note that KMP isn't a cross-platform framework which forms the base of your app. It's better to compare it with an additional library you add to your existing native app. The developer itself is in charge of how much code is shared between platforms, ranging from a single method to the whole app. Multiple official and community-backed libraries are available to ease development, from API calls to storage to UI development (like Jetpack Compose).

Why do we adopt this technology?

With KMM, you can write a single codebase in Kotlin that functions on both Android and iOS. This translates to faster development times and easier maintenance since you're not juggling separate codebases for each platform. Plus, Kotlin's syntax is familiar to Android developers, making it an easy language to pick up for iOS teams. KMM lets you share core functionalities while still allowing for platform-specific customizations, giving you the best of both worlds.