The Unique Advantages of Kotlin Multiplatform Over Other Cross-Platform Solutions

Understanding How KMP Stands Apart

Ryan W
Stackademic
3 min readDec 4, 2023

--

In a recent Kotlin Multiplatform (KMP) webinar, JetBrains highlighted the distinctive features of KMP, setting it apart from other cross-platform frameworks.

This image was created using an AI image creation program.

KMP offers unprecedented flexibility in cross-platform development:

  • We can share only a small portion of business logic in Kotlin while keeping the rest of the apps (including the UI) native to Android, iOS, etc.
  • It’s possible to share all non-UI code in Kotlin, with UIs implemented separately on various platforms.
  • KMP allows for sharing a choice of non-UI and UI code (through Compose Multiplatform) across platforms.
Slides courtesy of JetBrains.

KMP works like an extra library

We can imagine KMP works like compiling a native library/dependency for each native platform, such that the respective native project can use the common features implemented in the shared module.

Slide courtesy of JetBrains.

KMP’s Unique Exit Strategy

KMP provides a unique safety net: if the multi-platform approach proves unsuitable, the Kotlin code within the KMP project can still be reused as native Android code.

For the UI implemented using Compose Multiplatform, it is also easy to convert back to the Jetpack Compose UI for the native Android code project.

This flexibility allows developers to transition to or from a cross-platform approach gradually.

🙋‍♂️ Considering existing options like Flutter and React Native, how likely can we do something similar?

KMP does not force us to have a shared UI in a multiplatform project

Consider an app with complex data-processing functions. Typically, developers on different platforms must implement these separately, leading to inconsistencies. With KMP, a single implementation in Kotlin can be shared, ensuring uniformity and reducing errors. Similarities can arise between platforms due to communication gaps or developer preferences even in simple cases, like extracting initials from a name. KMP offers a solution by enabling a shared implementation for such functions.

KMP’s flexibility means that the rest of the app does not have to be cross-platform, allowing developers to create a shared library for certain features rather than being forced into a binary choice between fully platform-dependent and fully cross-platform development.

Addressing the Human Element: The Real Challenge for KMP Adoption

Reflecting on my experience from a year ago, when I first proposed KMP, the initial resistance often stemmed from non-technical issues. For example, an iOS developer’s reluctance was more about office dynamics than technical constraints.

Recognising this, JetBrains is actively promoting KMP within the iOS community. A significant portion of iOS work is included in their 2024 Road Map.

JetBrain’s position as an independent entity from Google places it in an advantageous position to develop and promote tools that bridge the gap between the iOS and Android ecosystems.

Stackademic

Thank you for reading until the end. Before you go:

  • Please consider clapping and following the writer! 👏
  • Follow us on Twitter(X), LinkedIn, and YouTube.
  • Visit Stackademic.com to find out more about how we are democratizing free programming education around the world.

--

--

Android | Kotlin Multiplatform | Jetpack Compose 📱Releasing Android Apps since 2010 - dealing with the ecosystem not just coding