Understanding Kotlin Multiplatform Mobile

Ayaz Qureshi
4 min readNov 13, 2020

With every day passing the need for single code — multiple-use thing is growing. Our audience is on mobile as well as on the web & desktop. Providing service on a single platform doesn’t seem right from any angle. In the conquest to be the master of multiple platforms, Kotlin Multiplatform has proven itself a worth-a-try SDK.

According to the official website:

Common Kotlin includes the language, core libraries, and basic tools. Code written in common Kotlin works everywhere on all platforms.

With Kotlin Multiplatform libraries, you can reuse the multiplatform logic in common and platform-specific code. Common code can rely on a set of libraries that cover everyday tasks such as HTTP, serialization, and managing coroutines.

To interop with platforms, use platform-specific versions of Kotlin. Platform-specific versions of Kotlin (Kotlin/JVM, Kotlin/JS, Kotlin/Native) include extensions to the Kotlin language, and platform-specific libraries and tools.

Through these platforms you can access the platform native code (JVM, JS, and Native) and leverage all native capabilities.

As stated above, Kotlin Multiplatform Mobile (KMM) is an SDK for cross-platform mobile development created by JetBrains. It uses the multiplatform capabilities of Kotlin and has various tools and features designed to make the end-to-end experience of building mobile cross-platform applications as enjoyable and efficient as possible.

This plugin is still under development but with KMM, you can get this flexibility and retain the benefits of native programming. Use a single codebase for the business logic of iOS and Android apps and write platform-specific code only where it’s necessary, to implement a native Ul or when working with platform-specific APIs.

Key Features

SINGLE CODEBASE FOR THE BUSINESS LOGIC WITH KOTLIN MOBILE SDK

Photo by Deb Dowd on Unsplash

Kotlin Multiplatform Mobile allows you to use a single codebase for the business logic of ioS and Android apps. You only need to write platform-specific code where it’s necessary, for example, to implement a native Ul or when working with platform-specific APIs.

GET ALL THE CROSS-PLATFORM BENEFITS IN YOUR EXISTING PROJECT

Photo by Mike Petrucci on Unsplash

With Kotlin, if you want to make an existing project suitable for multiple platforms, you don’t have to go back to the drawing board. You can use the code you’ve already written and simply modify it to be compatible with iOS. You can even migrate your code in stages. So no matter how large your project is, your existing code will not prevent you from integrating KMM.

USE IOS AND ANDROID FEATURES WITHOUT ANY OVERHEAD

Photo by Hardik Sharma on Unsplash

Kotlin Multiplatform Mobile does not impose any restrictions on how you develop your app’s Ul or how you work with the platforms. Whenever a task cannot be solved in the shared code or whenever you want to use specific native features, you can use the expect/actual pattern to seamlessly write platform-specific code.

USE KOTLIN FOR CROSS-PLATFORM CODE

Photo by Louis Tsai on Unsplash

You don’t need to introduce any new languages to your codebase to make your app cross-platform. Android developers that are already familiar with Kotlin know it to be a concise, safe, tool-friendly language that drastically improves the developer experience. Kotlin syntax is also easy to learn for iOS developers because it is based on the same modern concepts they are used to, so your whole team will be able to write cross-platform code efficiently.

The search for one perfect SDK will continue forever, but KMM is undoubtedly a one to go over other SDKs looking at its promising features and principles.

That’s it for now. Peace ✌️

--

--

Ayaz Qureshi

I write about startups, entrepreneurship mindset, strategies and app development.