Is Kotlin Emerging as a Multiplatform Language?

Image for post
Image for post

The smartphone in your pocket or that is sitting on your desk are impressive pieces of hardware in their own right, and keep you connected to your life and the people within it. But what is really impressive is the operating system running on them because that is what makes the real magic happen.

These operating systems are all different and as such, require different frameworks, tools, and languages for application development. However, today, I am going to focus on just one, Kotlin. That’s is because it isn’t very often a programming language that gets adopted as a specialized framework for the Android platform, only to evolve to now support iOS. Needless to say, Kotlin is well on the road to being a widely-used, multiplatform programming language.

But, I think I am getting ahead of myself. Let’s take a step back and start at the beginning.

Kotlin and Kotlin/Native: A Brief Overview

Kotlin came into existence in July 2011, a product of JetBrains. However, it wasn’t until May 2017 that Google announced its support of Kotlin, over a year after its first official stable version (Feb 2016). Since then, Kotlin has become the preferred language for Android application development. Slowly, but steadily, it’s also growing popular for other platforms, including iOS application development. Kotlin/native is used for this purpose, which compiles the Kotlin code to native binaries that run without any virtual machine. Kotlin/native is an LLVM (Low-Level Virtual Machine) based backend for Kotlin compiler that converts the Kotlin code to LLVM Intermediate Representation (IR). The LLVM compiler understands that Intermediate Representation and creates binaries for multiple platforms.

Image for post
Image for post

Both iOS and Android platforms have different approaches when it comes to native application development. But now Kotlin has made it comparatively easy by supporting both. This saves the additional effort of developers in learning two different programming languages [Java & Swift]. Developers can now develop the business, network, and repository layer in Kotlin as a dependency module for native applications. iOS and Android apps can use the same libraries, saving them time and effort in creating two. The below diagram shows the separated layers of the application architecture while following the Kotlin based custom developed multiplatform library.

Benefits of Kotlin in Multiplatform App Development

Image for post
Image for post

The ability to share code between mobile platforms is undoubtedly one of the most important and appealing use cases of Kotlin, however, they extend beyond that. Here are a few of the more commonly experienced benefits of developers cite from using Kotlin:

Key Challenges With Kotlin

  • It’s a timely and cost-effective solution to develop common layers in your mobile application development architecture

Initially, every programming language starts with its own set of challenges, and the one reason this will keep happening as it takes a community to help refine. As a new programming languages’ ecosystem builds up, so to will increase its adaptability, reliability, and function. However, this can take months, if not years. Considering this, developers might encounter some challenges while using Kotlin for iOS and Android app development and here are a few to be wary of:

Does Kotlin Makes App Maintenance Easier?

Image for post
Image for post
  • As a comparatively new platform for iOS app development, it’s not without challenges and issues. It lacks a mature ecosystem for iOS app development which can create obstacles for developers looking for outside the box solutions.

Take away

It’s a common understanding that an application is easier to maintain if there is a higher portion of shared code. For example, if an application has core modules developed in Kotlin that are shared across the platform and cover 80% of the business logic. Now, let’s say there is a change in the requirement to upgrade the repository layer and add a new collection in the database schema. The developers in such a case only have to manage this change from the centralized Kotlin based shared library. It results in reflecting the difference in both iOS and Android platforms, which eventually saves time and cost effort for the business. So in short — yes

The above was written in collaboration with Imran Mian, Vice President of Digital Transformation and Abrar Ahmed Sair, Senior Android Developer, both of mobileLIVE.

The critical point to focus on here is how rapidly technology is changing and how it benefits mobile app development. We can confidently predict that, soon, Kotlin/native will be one of the key contributors in multiplatform mobile app development. The main advantage Kotlin/native has over other frameworks is its operability with Java and Swift. It also allows developers to develop the native iOS and Android applications using shared code. Sharing a significant part of the codebase between iOS and Android gives an experience of enhanced maintainability. This results in cost savings and enhanced value that all stakeholders, from developer to end-user, can feel.

Like what we say? You’ll love what we do. See for yourself.

Written by

One of Canada’s fastest-growing technology companies, helping brands accelerate their #DigitalTransformation.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store