We asked an iOS developer his thoughts after working with Kotlin/Multiplatform Mobile

Salomon BRYS
Kodein Koders
Published in
4 min readMay 13, 2021
Photo by Mihai Moisa

At Kodein Koders, we think that Kotlin Multiplatform Mobile will only rise with the help and support of iOS developers. As KMM only abstracts application backends, we need to have both platform communities on board to create great products.

We were fortunate enough to work for several months with Robbie Hanson, a notorious iOS developer, on the new Phoenix Bitcoin Lightning Wallet KMM application for iOS and Android. We asked him to give us his feedback about the state of Kotlin/Multiplatform Mobile, and how it felt working with it.

With his gracious permission, here goes:

For mobile developers, the dream has always been to have a modern language for sharing code between iOS & Android. But for the last decade, the dream has remained just that. The available options were lacking.

There’s C++. I’ve been down that road before. When I worked with Verizon. It sucked. Hard. I wouldn’t wish it on my enemies.

And then there are the “let’s just use a web framework” solutions. Which is a clearly a good idea — to those who have never written a native mobile app in their life. Do you remember those horrible cross-platform Java apps from the 2000’s (with user interfaces made with Swing) ? It’s like that. Except now replace your user base with people who have never heard of AOL, and who grew up using the latest smartphones. Don’t expect them to be kind to your crappy UI, and your non-existent animations.

I was at WWDC when Apple announced Swift. And I remember hearing the other devs wax poetic about how “Swift is the new cross-platform language because it’s open source. We will be able to write Android apps in Swift !!!” But I was skeptical. Why would Apple want to help you make apps for Android ? It goes against their business model. Well… Swift has been out for many years now. Does Apple provide Android support for Swift? Nope. Do they provide Windows support for Swift? Nope. What they support is server-side Swift. Because that’s a completely different market.

Google has the same mindset. They don’t want to help you make iOS apps. It goes against their business model.

And then there was Kotlin Multiplatform. Finally a sane narrative for cross-platform development. Build your UI using native tools — using SwiftUI for example. And then build your shared business logic using a modern language.

It’s so obvious, one wonders how it took so long to appear. Clearly, the reason is a lack of business incentives. Building something like this involves a ton of money and effort. And after all that, how do you monetize it ? Well, we got lucky. JetBrains makes an IDE. And if they get more developers writing code in Kotlin, they can sell more IDE subscriptions. As long as that remains true, Kotlin multiplatform will improve. If, on the other hand, Google buys JetBrains… then you can throw all your Kotlin multiplatform code in the trash.

So is Kotlin multiplatform wonderful to use? I’m not going to sugarcoat it for you. It kinda sucks. The language itself is fine. But the current tooling for multiplatform is painful. If you want to use bleeding-edge tech, expect to bleed.

To understand what I mean, you have to know that the Kotlin world was born on the Android side of the wall. So iOS developers are second class citizens. For example, when I was first getting my system setup, I was told that I needed to install the Android SDK — in order to compile the project for iOS. Imagine my response. Or better yet, imagine how Android developers would feel if they were told that, in order to compile a project for Android, they first had to install Xcode. I complained about this until the Kodein team found a solution for me. And then I upgraded to IntelliJ IDEA v2021.1. And now the IDE tells me that I must have an Android SDK installed. And until I do, it refuses to provide any syntax highlighting or autocompletion or anything :(
(Editor’s note : we updated our workaround)

And then there’s the Gradle build system. If you’ve been comfortably using Xcode for years, get ready for a shock. You may have learned about makefiles — from the 90’s — in your computer science history class. Well, they’re back. And they’re just as annoying as before. With arcane syntax and lots of dependency compatibility issues.

I will say that writing asynchronous code in Kotlin is a pleasure. But the multiplatform system still has thorns when it comes to multithreading on iOS.

So would I recommend Kotlin? Well let me answer that by telling you a story about a previous company I worked for. We were just getting started, and Swift was brand new. And we had to make a decision: write our codebase in Objective-C, or use this new Swift language? The company decided on Objective-C. Fast forward a few years, and Swift is now mature, and growing fast. Objective-C is a relic. And SwiftUI is taking over. Did the company make the wrong choice? Yup.

So, yeah, I’d recommend Kotlin. I see it as a trade-off: short-term pain for long-term gain. But I would recommend putting a Kotlin Multiplatform expert on call. Somebody to help you with the bullshit — like Gradle. And FrozenObjectExceptions. You’ll see ;)

- Robbie Hanson

Editor's note: following this great feedback, we published our own thoughts to add our perspective to the conversation.

This article is brought to you by Kodein Koders, a European service & training provider focused on Kotlin & Kotlin/Multiplatform. You can visit our blog, or our Youtube channel for more content.

--

--