Kotlin Multiplatform

Kotlin Development.jpg

At Level 11, we thoughtfully design and develop mobile applications to interact with in-house and third-party web services. Our goal is to deliver a cohesive and polished experience in both Android and iOS. We are big fans of native development on both platforms because it enables us to bring the capabilities desired with the best level of performance, security, compatibility, and future readiness.

At the same time, we maintain a high interest in cross-platform technologies. We track new releases across several different projects. To stay abreast of changes we build prototypes with them. To stay grounded, we build our prototypes to solve real-life problems to measure the feasibility of the cross-platform solution. One such emerging technology is Kotlin Multiplatform.

Kotlin Multiplatform is an experimental solution introduced by JetBrains in version 1.3 to use the power of the different platforms Kotlin can target with the ability to generate native binaries. Its main goal is to facilitate sharing the same code where it makes sense while still maintaining certain platform-specific capabilities. This not only allows us to fulfill the original goal of sharing code between mobile clients but also tests the capabilities to cross boundaries to other web and native platforms including server applications.

On this first post, we will give you an overview of what Kotlin Multiplatform is and can do. A follow-up post will dive into a project structure and introduce useful libraries for serialization, coroutines, and networking.


What is Kotlin?

Kotlin is a modern programming language developed primarily by JetBrains, creators of popular development tools like IntelliJ and PyCharm. It targets the JVM, Android, JavaScript, and Native.

Offering 100% interoperability with Java, Kotlin gained steam quickly thanks to language syntax which results in very concise code, while offering stronger type-safety and the ability to use the language for both object-oriented and functional programming, or even a combination of both.

This popularity was cemented when Google announced first-class support for Kotlin on Android during the I/O 2017 conference, and most recently at I/O 2019 where Kotlin was named the preferred programming language for app developers.

Kotlin Multiplatform was introduced as an experimental feature starting with Kotlin 1.3. It allows creating a single Kotlin project that contains common code and optional specializations for each targeted platform.


What flavors of Kotlin are used in Multiplatform?

As mentioned before, Kotlin targets different platforms and is tightly integrated with the specific features such platforms have to offer.


This is essentially the purest form of Kotlin, where all non-platform-specific code can live. When targeting various platforms, developers benefit most by putting their business logic and code representing shared functionality in this layer. Operations requiring heavy processing and asynchronicity should be placed here to take advantage of Kotlin’s coroutines. When per-platform implementations are required for a given interface or method, Kotlin’s expect and actual keywords shine. Developers can expect implementation in the common library, then tag the implementation class with actual in the target platform’s library, letting the developer execute platform-agnostic logic within the shared code.


This makes Kotlin available to Java Virtual Machine (JVM) platforms. This is the most widely used by mobile developers due to interoperability with Java, which allows for any Java libraries to be used in conjunction with Kotlin. Android uses a version of this, as well as some special Android extension libraries, to make mobile development a breeze.


Kotlin can even be compiled straight to JavaScript for client and server code. This can open up a whole new world to web developers, providing them new immense power and structure to their web apps. It can be used to build UI using frameworks like React and jQuery or even to interact with WebGL to render 3D scenes.


Allows developers to compile Kotlin to native binaries. Supported platforms include:

  • iOS (arm32, arm64, simulator x86_64)

  • macOS (x86_64)

  • Android (arm32, arm64)

  • Windows (MinGW x86_64, x86)

  • Linux (x86_64, arm32, MIPS, MIPS little endian, Raspberry Pi)

  • WebAssembly (wasm32)

For our purposes, we will be targeting iOS to generate an Obj-C/Swift Framework that can be used by iOS applications directly.

Stay tuned for our next post where we will dive into the code and project structure for both Android & iOS!