Kotlin Multiplatform Mobile hits beta, aim is ‘to be stable next year’

Kotlin Multiplatform Mobile hits beta, aim is ‘to be stable next year’

JetBrains has released the first beta of Kotlin Multiplatform Mobile, a framework for coding applications for Android and iOS with the Kotlin language. “We are aiming next year to be stable,” product manager Ekaterina Petrova told DevClass.

Kotlin, an open-source project introduced by JetBrains in 2011, has been a Google-recommended language for Android since 2017 and the preferred language since 2019. It targets the JVM (Java Virtual Machine) and also has transpilers for JavaScript and, via the LLVM project, native code for macOS, iOS, Linux, Windows, and Android NDK (Native Development Kit).

It is currently the 18th most popular language in the Redmonk language rankings, just ahead of Rust. Kotlin is a good fit for JetBrains, whose IDEs run on the JVM, and the project has been nimbler about introducing new language features than Java itself, with its sometimes ponderous standardisation process.

The main drive behind Kotlin Multiplatform Mobile is the desire of developers to save time when coding the same application for both iOS and Android. Similarly, the broader Kotlin Multiplatform project, still in Alpha, is driven by the advantage of using the same language on both server and client.

Despite the previous Alpha status of Kotlin Multiplatform Mobile, Petrova said that “even some big enterprise companies are using Kotlin Multiplatform Mobile right now.” The issue, she said, has not been the reliability of the code, but that “in Alpha, we were experimenting with different parts like project configuration, things related to developer experience.” Another issue has been the memory manager and how concurrency works on Android and iOS.

“Now we’ve gone to beta we’ve stabilized all these things,” she told us.

Kotlin Multiplatform Mobile targets non-visual code. There is no cross-platform GUI, unlike Google’s Flutter, or Microsoft’s Xamarin and MAUI (Multi-platform App UI). “In iOS or Android, we’re using the best tools [for the GUI] which is SwiftUI [for iOS] and JetPack Compose [for Android], said JetBrains developer advocate Pamela Hill. “Those are the native tools, and your iOS app will look like an iOS app, and your Android app will look like an Android app.”

The same arguments were made by Xamarin in pre-Microsoft days, concerning their C# cross-platform tools, yet when Xamarin Forms was introduced, enabling a cross-flatform GUI, it was immediately popular. Might there be similar demand in the context of Kotlin Multiplatform for Mobile?

“It’s not a secret that Google is working on Jetpack Compose,” Petrova told us. “They are working on multi-platform capabilities, currently Compose for desktop and JavaScript. Our community was looking through some commits [to the code] and noticed that there is also work in progress on Compose for iOS.”

The implication is that JetPack Compose may in future be a route to a cross-platform GUI for Kotlin Multiplatform Mobile.

Why use Kotlin rather than Flutter for cross-platform mobile? Hill told us that Flutter, which uses Google’s Material Design UI theme, “on iOS, it doesn’t look native. On Android it looks fine.” Another issue with Flutter, she said, is that “it’s the whole toolbox, Dart and Flutter and Material Design all in one,” whereas for Kotlin, Multiplatform Mobile is something that ca be adopted gradually.

Despite supporting the native GUI toolkit on iOS, there is a sense in which Kotlin Multiplatform Mobile is more comfortable on Android. One of the issues is libraries. On iOS, “your libraries need to be multiplatform libraries as well,” said Hill, “whereas if you’re running on Android and using Kotlin there’s a lot less restrictions.”