JetBrains has announced that Kotlin Multiplatform (KMP) enables developers to write code in Kotlin and share it across platforms. This feature is now stable and ready for production in Kotlin 1.9.20, the latest version.
Kotlin Multiplatform initially started with Kotlin Multiplatform Mobile (KMM), allowing developers to write apps in Kotlin for Android and then run them natively on iOS. This approach reduces code maintenance efforts. Furthermore, it has expanded to other platforms like desktop and web, which led to its rebranding as Kotlin Multiplatform (KMP) to encompass a wider scope.
Leading companies such as Netflix, Philips, McDonald’s, 9GAG, Baidu, and VMware have successfully implemented KMP. For instance, 9GAG adopted Kotlin Multiplatform after experimenting with Flutter and React Native.
Below is an example of how an app could look on Android, iOS, and Desktop:
Kotlin Multiplatform is divided into two parts: the Core Kotlin code and the UI framework called Compose Multiplatform. The number of supported platforms varies between these two components. The Core Kotlin code is already stable and compatible with Android, iOS, desktop (JVM), server-side (JVM), and web (via Kotlin/JS). Another platform currently under development is Kotlin/Wasm (Web Assembly), which is in the experimental phase and expected to reach Alpha status in 2024.
As for Compose Multiplatform, it has reached stability for Android and Desktop (JVM), while iOS is currently in the Alpha phase and will progress to Beta in 2024. The web platform (Wasm) is still in the experimental phase.
Developers have the flexibility to choose which parts of the code they want to share, whether it’s specific sections, logical components, or the entire codebase, including the UI, depending on the project’s requirements.
Summary (TLDR): JetBrains introduces Kotlin Multiplatform (KMP), allowing developers to write code in Kotlin and share it across various platforms. KMP is stable and ready for production, offering compatibility with Android, iOS, desktop, server-side, and web. Leading companies, including Netflix and McDonald’s, have successfully utilized KMP. Compose Multiplatform, the UI framework, is stable for Android and Desktop (JVM), with iOS in the Alpha phase and the web platform in the experimental phase. KMP provides developers with the flexibility to choose which parts of the code they want to share based on their project needs.