JetBrains has released an alpha version of Kotlin Multi-platform Mobile (KMM), an SDK that enables developers to use the same business logic in both Android and iOS mobile applications.
KMM draws on the muliti-platform capabilities of Kotlin to streamline the end-to-end experience of building cross-platform mobile applications. The SDK is enabled by a preview of a KMM plug-in for the Android Studio IDE that allows developers to write, run, and debug shared code in the same IDE.
JetBrains said Android and iOS versions of an application can have a lot in common but also significant differences, particularly in the UI. Differences can range from subtle variations in scrolling behaviour to divergent navigation logic.
However, because application business logic including data management, analytics, and authentication can be identical, it’s natural to share some parts of an application across platforms while keeping other parts separate.
KMM offers flexibility while retaining native programming benefits. A single codebase can be used for business logic while platform-specific logic can be written when necessary, whether for a native UI or to work with platform-specific APIs.
Shared code written in Kotlin is compiled to JVM bytecode with Kotlin/JVM and to native binaries via Kotlin/Native. Thus, KMM business modules can be used like any other mobile library. With the plug-in, developers do not need to switch IDEs and have Apple’s Xcode running to ensure that code works properly on both platforms.
Companies already have saved time and effort sharing code between platforms, such as Quizlet and Fastwork, JetBrains said. The company has set up a KMM developer portal and published a guide on integrating KMM into existing projects.