Open-sourcing Kotlin Multiplatform Standard

profile picture

Arne Tech Lead

profile picture

Vincent Engineer

3 Oct 2018  ·  3 min read


We’ve been Kotlin fans from the start, and since its ability to set up multiplatform projects, we’re even more convinced it is here to stay. With KotlinConf on the horizon, we want to share our first Kotlin multiplatform repository with the tech community.

Kotlin at November Five

Ever since our last Kotlin blogpost, we are actively using Kotlin in our production code. And the backing of Google meant we even adopted Kotlin as the default programming language for our Android applications.

Kotlin already supported iOS too, - via Kotlin/Native - but only with the more recent introduction of multiplatform support, we got eager to further explore sharing Kotlin code across platforms.

Multiplatform support allows us to use identical business logic between Linux, Mac, Windows, and — most interesting to us — Android and iOS. With it, JetBrains solved one of the final missing puzzle pieces required for Kotlin/Native to be mature enough for actual development.

So we decided to give it a try!

A deep dive into some existing samples quickly learned us there is no setup available for us to use. They all didn’t match our preferred way of working, because of two main differences:

  1. They all require using a single repository for both the Android and iOS application. This would cause a lot issues for us as we already had two separate repositories. Merging the existing repositories of our apps was simply not an option for us.

  2. None of them have a setup for hosting the code on a Maven repository, or by using CocoaPods. At November Five, we separate and version our libraries, so this was an absolute must.

On top of that, we noticed a lot of other developers preferred to use CocoaPods or Maven too.

Kotlin Multiplatform Standard

We decided to create a setup that could solve both issues, and by open-sourcing our results, we hope to help and inspire other developers with the same goals.

In our setup, we decided to distribute our Kotlin codebase as a standard Android library, hosted on Maven, using a single line in our build.gradle file. For iOS, we distributed a universal framework file via CocoaPods.

The result is our Kotlin multiplatform standard: a simple setup which allows us to reuse code on both Android and iOS, and to apply platform-specific logic just like any other regular (hosted) Android/iOS library.

The repository is available on GitHub, and contains sample implementations for multiplatform support, both for development - using local sources - and for stable versions, which will be available on Maven (via Bintray) and CocoaPods.

The sample/android-app and sample/ios-app projects are configured to use the local Kotlin sources and are ideal for development, as they will automatically compile the latest sources at build time.

The sample/ios-app-cocoapods, and sample/android-app-bintray projects are configured as an example on how to use your library hosted with CocoaPods/Bintray.

What’s next

The project in which we use this setup is still in development, however, it has been fully tested and did already provide us with valuable insights. Now, we hope the feedback of the community will further allow us to learn and improve.

Next, we’ll upgrade the Kotlin/Native plug-in to the new project model.

On top of that, we’re very curious to see what other opportunities KotlinConf might unravel, as this might just be only the tip of the iceberg with regard to what Kotlin multiplatform can offer us.

See you there!

Are you triggered by our way-of-working or tireless quest for improving our engineering skills? We’re happy to hear your thoughts on the project. And don’t forget to take a look at the jobs page, both Spencer and November Five are hiring big time!