Back to blog

Kotlin MPP: Basics

Kotlin MPP Introduction

When we set out to build our mobile SDKs at Dyte, we decided early on that we wanted to reuse as much code between platforms as possible. It would save us a lot of time and effort as a small team not to have to implement everything twice — once for iOS and then again for Android.

Taking cues from Dropbox

There simply weren't many options available to achieve what we had set our minds to. We could write C++ (or Rust) and then use FFI bindings from them to iOS and Android, but the overhead of learning a completely new and unfamiliar language made it quite a risky option. Dropbox had been a big champion of this strategy, and it worked for them for a long time.

Still, ultimately, the friction of forcing mobile developers to write C++ ended up with them ditching the idea and just opting to build stuff twice in the platform's respective native languages.

The blended alternative of Kotlin MPP

Kotlin offered us an optimally blended alternative way to do this. It was a language already familiar to our Android developers and was relatively easy for iOS engineers to pick up due to its syntactic familiarity with Swift.

It is easier to write than C++, and the excellent Kotlin Multiplatform toolchain ensured we were not taking on avoidable FFI overhead by being able to compile our code down to platform-native formats.

Kotlin Multiplatform was announced at KotlinConf 2017 under the name Kotlin Multiplatform Projects (MPP) and initially supported JVM, Native, and JavaScript. It enabled the Kotlin toolchain to compile executables and libraries for different platforms from a single, shared Kotlin codebase. The powerful expect/actual system of bridging platform-specific APIs into standard code allows for common business logic to be written once but still be able to lean into the target platform for specific things.

Leveraging bidirectional interoperability

Unlike other cross-platform solutions, which tend to invent everything themselves and treat native interoperability as an afterthought, Kotlin strongly focuses on bidirectional interoperability. Kotlin Multiplatform can consume dependencies written in the platform's target language, expose them within Kotlin, and compile them to the same binary format as the target language.

For example, Kotlin code for Apple platforms can consume Cocoapods libraries through Kotlin's first-party Gradle integration, and developers can use the libraries like any other Kotlin code. This also goes in the other direction — the Kotlin Gradle plugin enables building Kotlin libraries into XCFramework bundles that can be imported into Xcode projects.

At Dyte, we leverage Kotlin Multiplatform's vast ecosystem to build all our mobile SDKs from a single shared codebase written entirely in Kotlin. It enables us to deliver a consistent API and feature set across iOS and Android without compromising quality for either platform.

Its powerful publishing tooling ensures that our usage of Kotlin Multiplatform remains transparent to our clients. Clients using our SDK on Android see a regular AAR file; on iOS, they get an XCFramework. Thanks to this, our SDKs integrate painlessly into existing mobile codebases like any other dependency.

Final thoughts

In conclusion, Kotlin MPP is an excellent tool for efficient cross-platform development. Allowing for shared code between mobile platforms and prioritizing bidirectional interoperability makes delivering a consistent experience across platforms easier without compromising quality. At Dyte, we've seen firsthand the benefits of Kotlin Multiplatform, and we're excited to see where it goes in the future.

We hope you found this post informative and engaging. If you have any thoughts or feedback, please reach out to us on LinkedIn and Twitter. Stay tuned for more related blog posts in the future!

If you haven't heard about Dyte yet, head over to to learn how we are revolutionizing communication through our SDKs and libraries and how you can get started quickly on your 10,000 free minutes, which renew every month. You can reach us at or ask our developer community.

Great! Next, complete checkout for full access to Dyte.
Welcome back! You've successfully signed in.
You've successfully subscribed to Dyte.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.