Kotlin Multiplatform: Usability for Companies

Bo Liu
Axel Springer Tech
Published in
3 min readJun 5, 2024

What’s Kotlin Multiplatform?

Kotlin Multiplatform(KMP) is designed to simplify cross-platform development by enabling code sharing across Android, iOS, web, and desktop platforms. This approach can significantly reduce development time and costs, as well as ensure consistent functionality and performance across different environments.

Learn more: https://kotlinlang.org/docs/multiplatform.html

Benefits for Companies

Even though WELT news app is not using KMP, we have been keeping an eye on it. We are interested in it because of following reasons:

  1. Reduced Development Time: Share common code for networking, data models, and business logic across platforms.
  2. Cost Efficiency: Minimize the need for platform-specific teams.
  3. Maintainability: Easier to update and maintain a single codebase.

Obviously, some advantages are common for the other cross-platform frameworks, but an explicit thing is that developers don’t need to learn extra languages such as dart, nodejs. We already have kotlin experts working on android and backend. Meanwhile they can still use their familiar frameworks.

Potential Risks and Issues

We believe KMP can make our lives easier, but still some risk we have to consider:

  1. Learning Curve: Requires iOS developers to be proficient in Kotlin as well and understand the multi-platform ecosystem.
  2. Platform-Specific Challenges: Certain platform-specific features may still require custom implementations.
  3. Tooling and Ecosystem Maturity: While improving, the ecosystem and tooling are not as mature as some other frameworks, which could lead to integration challenges.

Whether using KMP usually depends on iOS developers instead of Android guys. iOS devs are more familiar with Apple ecosystem specifics, which is easy to ignore in the other cross platforms. I think that’s one of the reasons why those platforms didn’t succeed, so many iOS guys still insist to use native development.

KMP is walking on a different path, it’s developing from shared foundation to UI layer, not reverse. Thus, iOS side still have chances to develop with native UI framework such as UIKit and SwiftUI. It’s more acceptable for iOS.

For some startups, they can only hire Kotlin developers to serve multiple platforms, while big companies also can use KMP shared common library. That’s why I’m optimistic about this.

Why we have not use KMP for production yet?

However, we still have a critical reason not to adapt it. KMP only can generate Objective-C code so far. It’s a really drawback for KMP. I believe Objective-C definitely is a nightmare for many senior iOS engineers when calling it in a swift project. It lacks a lot of necessary suger syntax and is not safe. Jetbrains announced that the native swift support is working in progress, but there’s no exact release date.

Skie

Therefore, we explored workaround as well. We found a complier plugin called Skie. It designed to improve the iOS development experience within Kotlin Multiplatform by enhancing Swift interoperability. Traditional methods of integrating Kotlin with Swift via Objective-C often lead to limitations, but SKIE modifies the Xcode Framework produced by the Kotlin compiler to retain essential language features.

Learn more: https://skie.touchlab.co/intro

Benefits

  1. Enhanced Swift Interop: Enables direct Swift-Kotlin communication, overcoming limitations posed by Objective-C intermediaries.
  2. Maintained Language Features: Preserves important Kotlin features that are otherwise unsupported when using standard interop methods.
  3. Ease of Integration: Works seamlessly with existing Kotlin Multiplatform projects, requiring minimal changes to the distribution and consumption of frameworks.

Disadvantages:

  1. Compatibility Concerns: SKIE is compatible only with specific Kotlin versions (from 1.8.0 to 2.0.0). Using incompatible versions may lead to build failures.
  2. Lag in Updates: New SKIE versions supporting the latest Kotlin releases may have slight delays, potentially impacting project timelines.
  3. Limited Preview Support: SKIE does not generally support preview versions of Kotlin, which could be a limitation for developers wanting to experiment with cutting-edge features.
  4. Performance: It doesn’t replace objective-C code, just add a swift layer. Thus, it extends compiling time and cause some potential issues of running performance.

To be honest, it’s hard to prove Skie is a reliable tool so far so we don’t plan to use it for production. Nevertheless, it still an amazing stuff for some KMP demo app, which reduced some barriers for us in the current situation.

I know many companies already started to use KMP, it resolves a lot of problems of prior similar frameworks. For us, in terms of the consideration in this article, we are looking forward to the native swift from KMP.

--

--