· 6 min read Posted by Touchlab Engineering

Kotlin Multiplatform is Stable

After several years of hard work by the JetBrains team, Kotlin Multiplatform reaches stable with the 1.9.20 release. This is a critical milestone for the platform and ecosystem.
Marc A. Hermann / Metropolitan Transportation Authority (MTA) https://www.flickr.com/photos/mtaphotos/51663040540/in/photostream/
Credit: Marc A. Hermann / Metropolitan Transportation Authority (MTA) https://www.flickr.com/photos/mtaphotos/51663040540/in/photostream/

Kotlin Multiplatform was first announced at KotlinConf in 2017. Today, after years of work and amazing progress, Kotlin Multiplatform is stable! Along with progress on the tooling and library ecosystem, designating KMP to be stable will significantly increase adoption of the technology. Touchlab has been contributing to the KMP platform since the beginning, and some of our best work is still to come.

What does stable mean?

To some degree, alpha, beta, stable, etc, are just labels. Publishing your app with Kotlin 1.9.20 is unlikely to be much different than if you had done it with Kotlin 1.9.10. However, promoting KMP to stable means quite a bit.

Some orgs are OK with taking on technical risk by adopting new technology early. Most orgs aren’t. Making KMP stable signals to these orgs that KMP is something they can safely adopt. We’ve talked to many orgs who have looked at KMP, but ultimately decided that they needed to hold off until KMP is “production ready”. Again, to some, “stable” is just a label, but to many, it’s not.

Specifically, making KMP stable means the tooling and Gradle config are unlikely to introduce breaking changes with new versions.

While the KMP Gradle config has evolved quite a bit, many teams have been running Kotlin on iOS for years. The runtime itself is quite stable, and has been so for some time. This is a nuance that is often lost when discussing KMP, but with the whole platform reaching stable, it’ll be easier to present KMP to your team.

Touchlab and Kotlin Multiplatform

Touchlab has been contributing to KMP since the beginning. There’s quite a bit to that history. From sitting in that KotlinConf 2017 Keynote (anybody remember the alarms going off?), through this week’s updates, we’ve been heavily involved. Here are some highlights:

Critical Production Tools

Touchlab publishes several critical libraries and tools for native mobile teams using KMP, some of which are referred to in JetBrain’s official documentation.

SKIE (Swift/Kotlin Interface Enhancer)

SKIE enhances the API published from Kotlin to Swift, improving the iOS developer experience, making shared Kotlin easier to write, and improving type-safety in several ways that are lost with the stock Kotlin compiler.

Read more here

Every new KMP project being called from Swift should have SKIE enabled by default. It really does improve the Kotlin and Swift dev experience. Existing projects generally find workarounds, but those teams should understand what SKIE offers and incrementally add it to their projects.

SKIE 0.5.2 for Kotlin 1.9.20 is live!

KMMBridge

KMMBridge allows your team to easily publish Xcode Framework binaries from your shared Kotlin code.

It is a Gradle plugin that helps package and publish Kotlin Xcode frameworks to be used as dependencies from Swift Package Manager (SPM) and CocoaPods. Along with the Gradle plugin, there is an opinionated GitHub Actions workflow and a template starter project.

In our experience, most teams start by publishing an Xcode framework that their iOS developers pull into their projects. Setting that up by hand is a huge effort. That is why we made KMMBridge. If you are using GitHub, with our template project, you can have some Kotlin code imported into an iOS project in about 30 minutes.

Slack thanks (source: Kotlin Slack thread)

Our GitHub Actions workflow is specific to GitHub Actions and GitHub Packages, but KMMBridge itself is not. If you want to publish your binaries to another host, KMMBridge just needs you to implement an interface. For a different CI, you will need to replicate the steps in our GitHub Actions workflow, but none of the steps are complex, so this should be straightforward. Contributions and public samples of other CI implementations are, of course, very welcome!

Kotlin Xcode Plugin

Our tool lets you debug Kotlin directly from Xcode and also provides source highlighting for Kotlin files.

While Xcode can display and debug other languages though lldb, there is understandably no interest at Apple to make it easy. We are using undocumented features of the IDE to support this.

Thanks to some really great engineering work and enthusiatic community effort, our plugin works with the current version of Xcode, 15.

Coming Soon

We have a lot of content coming out soon. For teams looking at KMP, here are some important highlights.

To get updates on the latest content and releases, sign up for our newsletter, and/or find us in various other places.

Kotlin Professional Evaluation Guide

Most tutorials for KMP focus on the local developer process and the Kotlin-side of the developer experience. These are important topics, but lack an emphasis on how teams evaluate and use the technology in production applications.

A large portion of Touchlab’s experience and tooling focuses on teams and the iOS developer experience, which is reflected in our content and tools. This guide will present Kotlin from a team perspective, and discuss topics related to evaluation, adoption, scaling, and publication.

If you’ve been considering KMP for your team, or explored the technology in the past and decided to wait, now is a great time. With Kotlin Multiplatform at stable, and the excellent tools and expertise available, leveling-up your development team’s efficiency has never been easier.

KMP for SDKs

KMP is a great option for publishing native mobile SDKs from a single codebase. This is becoming much more common internally at organizations with multiple mobile teams, and within teams that use a feature-based approach to modularization. Products that need to export native mobile SDKs for external users are also starting to use Kotlin.

Publishing an SDK involves several potential concerns that writing shared code for a specific team does not. We have worked with several clients publishing SDKs with Kotlin. This content series will outline some approaches and the basic tools you should evaluate and decisions you’ll need to make.


6 years of KMP

Just imagine what we’ll be talking about in 2029…

KotlinConf 2017 (KotlinConf 2017 KMP Announcement)