The State of Kotlin Multiplatform — Webinar 2023

Jorge Luis Castro Medina
6 min readDec 2, 2023

--

In 2023, Kotlin Multiplatform has garnered significant attention for its development, current status, and future potential. As more developers express interest in adopting KMP for cross-platform solutions, JetBrains responded with a series of webinars in the latter half of November. The inaugural webinar, focusing on the The State of Kotlin Multiplatform, aimed to address developer inquiries. Today, I’m thrilled to share a concise summary of the key insights from this informative session 😊.

Svetlana Isakova & Márton Brau

Let’s get started!

What is Kotlin Multiplatform?

Kotlin Multiplatform allows you to create applications for various platforms and efficiently reuse code across them while retaining the benefits of native programming. Your multiplatform applications will work on different operating systems, such as iOS, Android, macOS, Windows, Linux, and others.

Kotlin Multiplatform documentation

The KMP code will be compiled into a .jar file for Android and a .framework file for iOS. Subsequently, we can incorporate it as a standard dependency in the Android/iOS project.

Kotlin Multiplatform Is Stable and Production-Ready

The Jetbrain team announced that KMP is now stable a couple weeks ago, which means we can use it in production without any fear, of course, many projects had been created with KMP, before this notice.

Having Kotlin Multiplatform stable gives us:

  • Strict compatibility guarantees: Check kotl.in/kmp-stability
  • Easier configuration
  • Faster builds
  • Better runtime performance
  • New documentation

Libraries

Since Beta, the number of KMP libraries has multiplied, offering diverse tools for networking, data storage, arithmetics, analytics, and more, enabling swift and confident app development.

If you want to see a list of such libraries, a good resource could be Awesome Kotlin Multiplatform

Successful Stories

You can find the complete list of stories in the following link, where you will discover the challenges people faced during the adaptation period, the various design choices they made, and the advantages they found after implementing KMP

Default hierarchy template

One of the improvements the JetBrains team has been working on is enhancing the build configuration experience to make it easier to get started with Kotlin Multiplatform. Let’s take a look at the code below.

Configuring Targets

Now, let’s review the sourceSets section; it contains the directories for the different targets of the KMP project. Even in the most common scenarios, some work will be needed to set them up. For example, if we consider the case of iOS, we’ll need to create different sourceSets for the various architectures. Starting with Kotlin 1.9.20, simply declare the targets you need, and the sourceSets will be generated for you automatically. KMP uses something called the Default Hierarchy Template for this.

You can use sourceSets to define dependencies for each platform.

Get started with Kotlin Multiplatform

The JetBrains team has worked on another thing, a new documentation portal. It contains a detailed guide on how to start with KMP, how to publish your app, samples, and more. You can open it with just one click on the following link: kotl.in/kmp-portal.

Kotlin-Swift interopedia

During the webinar, a little about Kotlin-Swift interopedia is also mentioned, which refers to the current state of interoperability between Kotlin and Swift. This is a repository that was born from the community and improved by the JetBrains team. It covers different aspects such as functions, exceptions, Data class, and so many others. check the following repository to see more: kotl.in/interopedia

Compose Multiplatform

Try Compose Multiplatform: jb.gg/compose

Recent improvements: 1.5.0

  • Dialogs, popups
  • Window insets
  • Natural scrolling for iOS
  • 120 Hz refresh rate
  • Stabilized test framework for desktop
  • All Material 3 components now available: ModalBottomSheet, SearchBar, DockedSearchBar, ExposedDropdownMenuBox
  • TextField improvements for iOS
  • Compiler caching compatible, faster incremental build
  • K2 support preview

Kotlin Multiplatform Wizard

Since now, we have a new easier way to create KMP Projects called Kotlin Multiplatform Wizard. This is a web-based wizard that provides the latest state and dependency versions. You can open it from the following link: kmp.jetbrains.co. For instance, you can choose the platforms you want to target and whether you want to share the UI or not.

kmp.jetbrains.com

Fleet

Now it is time to talk about Fleet, and at this point, a small comparison of this tool with Android Studio is made. Normally, Android Studio is the IDE used to work on a KMP project, but we have a small detail, and that is that Swift files are listed as unsupported text files, whereas Fleet arrives with compatibility for Swift 😎🚀.

But what is Fleet? Fleet is the next-generation IDE by JetBrains, built from scratch, based on 20 years of experience developing IDEs. JetBrains Fleet uses the IntelliJ code-processing engine, with a distributed IDE architecture and a reimagined UI. It is important to mention that Fleet is currently in preview.

Fleet is polyglot, which means it supports many languages. The most interesting for us is that it supports Kotlin and Swift.

Fleet is polyglot

Fleet: Summing it up

  • The next-generation polyglot IDE by JetBrains
  • Provides cross-language support for Kotlin and Swift
  • Is free during a public preview

Amper

This is the latest tool recently announced by the JetBrains team. Amper is a tool for project configuration. Its goal is to enhance the user experience in project configuration and the ease of use of tools, that is, compatibility within the IDE, while providing a straightforward initial experience.

Here is an example of Amper’s manifest file for a Kotlin Multiplatform shared library that can be used with JVM, Android, and iOS applications:

You can start by checking Amper’s GitHub repository where you will find more details and many usage examples: github.com/JetBrains/amper

Links:

Github: github.com/JetBrains/amper

Slack channel: jb.gg/amper-slack

Q&A

In this article, I didn’t cover the questions and answers as they take up approximately 1 hour of the webinar. I recommend checking the video at the end of the talk in the Q&A section for more details.

If you like my content and want to support my work, you can give me a cup of coffee ☕️ 🥰

Follow me in

--

--

Jorge Luis Castro Medina
Jorge Luis Castro Medina

Written by Jorge Luis Castro Medina

I'm a Software Engineer passionate about mobile technologies, and I like everything related to software design and architecture

Responses (1)