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.
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:
- 2017-2018: Early prototypes, SqlDelight (demo, first driver, current driver), first KMP iOS app in store (maybe?), Stately
- End of 2018: Touchlab is all in on KMP
- 2019-2020: (Thanks Square!), Kotlin Xcode Plugin, Old Memory Model, CrashKiOS, Generics, KMP track @ Droidcon NYC 2019, KaMP Kit (rewind), Kermit
- 2021-Now: New Memory Model, First iOS Compose app in store, Library updates (too many links), KMMBridge and recent refresh, Lots of teams stuff, Kotlin Foundation, SKIE
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 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.
SKIE 0.5.2 for Kotlin 1.9.20 is live!
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.
(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!
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.
We have a lot of content coming out soon. For teams looking at KMP, here are some important highlights.
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 KMP Announcement)