What’s New in Kotlin Multiplatform Mobile Since Going Alpha
Kotlin Multiplatform Mobile (KMM), an SDK for cross-platform mobile development, went Alpha in August 2020. Over the past 9 months, the KMM ecosystem has been rapidly evolving:
- Each new Kotlin version comes with features and improvements that enhance the multiplatform development experience.
- KMM development tools, such as the KMM Plugin for Android Studio, are constantly receiving updates to make the process of creating cross-platform mobile applications more efficient and enjoyable.
- The community is actively contributing to the ecosystem by producing useful libraries, creating instructive sample projects, and sharing their experience of using KMM in production.
Please read on for an overview of the main ecosystem highlights since going Alpha so that you don’t miss any important updates. Or if you can’t wait to get your first hands-on experience, visit the KMM documentation portal to learn more and try it out!
In this blog post, you will find an overview of:
- KMM Plugin features and improvements, including Cocoapods integration support.
- Kotlin multiplatform related updates, including Kotlin/Native performance improvements.
- Main community content highlights, including new sample projects and multiplatform libraries releases.
- Documentation portal updates, including a new FAQ page.
What’s new in the KMM Plugin?
The KMM plugin for Android Studio can help you develop cross-platform applications. It lets you create new cross-platform mobile apps in just a few clicks and is tightly integrated with the iOS development ecosystem.
Stable and customizable integration with iOS
With the KMM Plugin you can run, test, and debug the iOS part of your application on iOS targets straight from Android Studio. Since the first release of the plugin, its iOS integration has become much more stable and configurable, and it now supports the latest iOS tooling. See the complete list of implemented iOS integration improvements.
Flexible project wizards
The KMM Plugin is also an essential tool for taking your first steps with KMM. You can use the plugin’s handy wizards to quickly create a new multiplatform project or add a multiplatform module to your existing project.
The latest plugin version provides the ability to use the Cocoapods integration for new KMM projects and modules. All you need to do is provide an additional KMM module description, and the plugin will generate all the required configuration code.
For a complete list of the new features and improvements in the KMM Plugin, along with the installation instructions and compatibility information, please visit the KMM Plugin releases page.
What’s new in Kotlin for KMM?
KMM is based on the multiplatform capabilities of Kotlin and uses Kotlin/JVM and Kotlin/Native to produce the platform artifacts – .jar for Android and .framework for iOS. Every Kotlin update improves the developer experience of building cross-platform mobile apps with KMM.
Better iOS integration with Kotlin/Native improvements
The Kotlin/Native team is heavily focused on the most awaited feature in the KMM community – the new memory management approach for Kotlin Native. We plan to present the development preview of the new memory management design by the end of summer 2021. Read the detailed status of this project in the Kotlin/Native Memory Management Update blog post.
While we’ve made significant progress in implementing the new memory management approach, we have given the other features of iOS development with Kotlin/Native our attention as well:
- Kotlin/Native received a prototype of the new escape analysis mechanism, which yields a 10% improvement in iOS runtime performance.
- Kotlin/Native can now handle exceptions thrown from Objective-C code in runtime to avoid program crashes. This lets you get information about the root cause and handle it properly. Learn how to opt-in.
- The Kotlin/Native compiler has received a series of updates to improve its performance. For example, the time required to rebuild the iOS framework in the KMM Networking and Data Storage sample has decreased from 9.5 seconds to 4.5 seconds. Learn how to speed up the Kotlin/Native compilation process on your project.
- CocoaPods integration received a number of improvements, such as rebuilding dependencies only when necessary and the ability to depend on more different types of libraries.
Stable tooling for your Multiplatform projects
Tools must be stable for you to enjoy working on any kind of project. After KMM went Alpha and a number of new multiplatform features were introduced, the Kotlin Multiplatform team focused on improving the frontend and IDE import stability for multiplatform projects. We’ve fixed many issues leading to “red code” in the IDE while working with multiplatform projects. We are going to continue improving the multiplatform developer experience, and to do this well we need your feedback. If you can spare a few minutes, please report any issues you find to YouTrack, our issue tracker.
Of course, these are just the main highlights. To see an informative summary of all the new features Kotlin provides for developing multiplatform mobile applications, please see What’s new in Kotlin for KMM in the KMM documentation portal. The page is being updated with each new Kotlin version so you won’t miss any important news!
What’s new in the community?
The community is the heart of any technology ecosystem. You really are the greatest source of inspiration and feedback for us! Since the first release, developers worldwide have been supporting KMM ecosystem development by sharing their experience of using KMM in their production projects and creating useful libraries and sample projects.
The growing number of KMM libraries
The number of KMM libraries is constantly growing, which means you can select the ones that best fit your project requirements:
- Realm, an easy-to-use open-source local database, now has a new Kotlin Multiplatform SDK. Read about the key design principles of the new SDK development.
- Decompose can help you share more code with KMM. Decompose provides Kotlin Multiplatform lifecycle-aware business logic components with routing functionality and a pluggable UI. Since KMM is flexible and allows you to choose how much of your codebase you want to share, you don’t have to limit its use to just your project’s core and business layers, and libraries like Decompose can help you achieve that goal.
KMM developers have many more needs waiting to be addressed, which means there are lots of opportunities for library authors. Consider learning how to build and publish a multiplatform library and joining this rapidly growing ecosystem!
New sample projects
Sample projects can be very helpful for getting your first hands-on experience with a technology. Thanks to an awesome community effort so far, you can choose a sample project based on your code-sharing scenarios, or play with them all:
- The D-KMP sample demonstrates how to fully share the ViewModel (including navigation layer) with KMM, implements MVI and CQRS pattern, and uses the latest declarative UI toolkits, Compose for Android and SwiftUI for iOS.
- The multiplatform-redux-sample shows how to build a cross-platform application with KMM and ReduxKotlin.
- The famous people-in-space project is a great demonstration of the full power of Kotlin Multiplatform technology. In addition to sharing all the business logic and using modern mobile UI toolkits, it uses Compose Desktop, so you can run this sample application on your PC!
The latest Kotlin Multiplatform User Survey showed us that more complex samples was the most popular request from the community, which is why we’ve introduced an official KMM production sample from the KMM team. It’s a simple RSS reader that you can download from the App Store and Google Play. Designed to demonstrate how KMM can be used in real production projects, it provides a comprehensive readme with an explanation of the architecture so you can apply the approaches in your projects.
New stories of teams benefiting from KMM
Sharing code between mobile platforms with KMM is becoming common among companies and individual developers all around the world:
- Netflix switched to Kotlin Multiplatform Mobile to optimize their studio app for reliability and increase its delivery speed.
- Philips is using KMM to become faster at implementing new features. They have also achieved more interaction between Android and iOS developers in their team.
- KMM is helping Down Dog launch features simultaneously on all platforms, boost development speed, and reduce the number of bugs. The team has even moved the majority of their iOS platform code from Swift to Kotlin; their entire project is now in Kotlin with the exception of just five Swift files.
Check out the case study section of the KMM portal for more inspirational stories from companies of all calibers as well as individual developers.
What’s new on the KMM portal?
We continue to develop the documentation portal to be your daily helper when working with KMM:
- The new FAQ page is a good starting point for your KMM journey. It includes answers to the most commonly asked questions, such as how to work with KMM on Windows. If your question is not covered, let us know!
- The new step-by-step guide will help you make your existing Android application cross-platform and working on both Android and iOS. Don’t wait until you begin a new project to enjoy the advantages of the cross-platform approach!
Reading documentation is not the only way to become familiar with the KMM. The new “Kotlin Multiplatform Multiverse” series of videos on the Kotlin YouTube channel covers such getting started topics as creating a new project and using Ktor for networking, so you can start deep-diving into KMM from the comfort of your couch.
That was an intense nine months! However, the best is yet to come, as KMM remains one of the key priorities of the Kotlin team.
The next important and heavily awaited milestone is moving KMM to Beta. We are working on a detailed plan for this and will publish a separate blog post about what KMM-related tasks will be completed before the Beta announcement. Most of them, including Support the Apple Silicon target in the Kotlin Multiplatform tooling and Prototype a new garbage collector, are in progress. See the Kotlin roadmap for more information on our current priorities.
We’re very happy to see the community growing and KMM being picked up by more and more companies all over the world. Join our mobile cross-platform adventure today!
Read and watch more
Watch Kotlin on YouTube:
- Kotlin Multiplatform Multiverse series
- Talking Kotlin: Kotlin Multiplatform with John O’Reilly
- Talking Kotlin: MVIKotlin and Decompose with Arkadii Ivanov
Read the Kotlin blog:
Learn more from the Kotlin and KMM docs: