Live data from Hacker News

Kotlin Multiplatform for Android and iOS Apps

rockandnull.com

21–30 of 82 posts

Re: Kotlin Multiplatform for Android and iOS Apps

#21
I really don't get the appeal of "multiplatform" rediscoveries. We already have the Multiplatform stack that is mature and truly Multiplatform: HTML+JS+CSS

If you need something close to the metal, you have C and others that are multiplatform. If you want to do something slightly platform specific you loose the multiplatform claim instantly anyway.

IMHO, if you are going to do something that is not an UI to an API or a database, just do it in the native toolset for the platform so you can do it properly. Otherwise, just do a web app.

Apple's iOS API&Frameworks is quite extensive, if you are not doing just an UI then you will likely need to learn that. And for the UI? If your app is going to match the iOS conventions, do it in SwiftUI or UIKit as Apple will handle most of the stuff for you. It's probably the same for Android, no?

Re: Kotlin Multiplatform for Android and iOS Apps

#22

I'm puzzled why Kotlin isn't getting enough attention on HN, at least as much as Rust or Zig. Kotlin is indeed popular in it's specific domain (Android & Java). But the company is keen to position it as "write once run anywhere" space with a strong focus on multiplatform development. 1. The build system provides platform specific bindings for free (huge plus compared to the hassle of writing the core in C/C++ and the…

iOS dev here. What you're missing is that a ton of native-code developers (me included) aren't interested in adopting an abstraction layer that has to be tweaked to approximate the look and feel of the native OS UI layer when we could just built it natively to begin with and save all that effort. We've seen PhoneGap/Cordova, we've seen React Native and we'll keep seeing money thrown away on pretending that there aren't real platform differences when there are.

Re: Kotlin Multiplatform for Android and iOS Apps

#23
post #3

From my admittedly limited experience KMM is a complete mess. There doesn't seem to be a reasonable feature set across platforms. Even the standard library has massive holes, forcing you to littler your code with expect/actuals everywhere. This might be manageable for my own code, but completely destroys the ecosystem. A very large number of important libraries only works the JVM. Jetpack Compose and Compose Multipla…

I would argue that the shared feature set is quite reasonable. You get coroutines, you get Ktor, date/time libraries, kotlinx.serialization. You even get metaprogramming via KSP.

I basically only write expect/actual implementations to talk to platform APIs, but even those, when abstracted correctly behave just like a normal API to users.

You still write the UI layer natively. IMO this is a positive not a negative unless you're working on a product that doesn't care about native UX. And if you REALLY want a shared UI layer, Compose Multiplatform seems to be right around the corner.

Re: Kotlin Multiplatform for Android and iOS Apps

#25
> With KMM the promise is that you can have a native app in one of the major platforms (Android) and a good-enough app for the other major platform (iOS).

> You might be able to write UI and business logic in Kotlin for your Android app, and easily port it to iOS to kick-start your app journey. When the app becomes big enough (and you choose so) you can write a native iOS UI and still share the business logic between the 2 apps.

This seems like the less common order, anecdotally.

Re: Kotlin Multiplatform for Android and iOS Apps

#26

I'm puzzled why Kotlin isn't getting enough attention on HN, at least as much as Rust or Zig. Kotlin is indeed popular in it's specific domain (Android & Java). But the company is keen to position it as "write once run anywhere" space with a strong focus on multiplatform development. 1. The build system provides platform specific bindings for free (huge plus compared to the hassle of writing the core in C/C++ and the…

I think modern Java has stolen a lot of Kotlin’s thunder. The differences between the languages shrink with each Java release, and server side Kotlin isn’t evangelized by its main cheerleader, google.

It’s a GC language, so rust/zig are not good comps. Go, Java, Scala, Server side JS/Node, or python. These are the comps.

Personally, I’ve written a number of non-trivial, server side applications in Kotlin. The extra cost of asking my colleagues to learn another language and some pain in the interop with Java has dampened adoption. It’s a shame, I find the coroutine library a joy to use, with none of the painful drawbacks of go, node, python, etc.

Re: Kotlin Multiplatform for Android and iOS Apps

#28

I'm puzzled why Kotlin isn't getting enough attention on HN, at least as much as Rust or Zig. Kotlin is indeed popular in it's specific domain (Android & Java). But the company is keen to position it as "write once run anywhere" space with a strong focus on multiplatform development. 1. The build system provides platform specific bindings for free (huge plus compared to the hassle of writing the core in C/C++ and the…

[deleted]

Re: Kotlin Multiplatform for Android and iOS Apps

#29
post #21

I really don't get the appeal of "multiplatform" rediscoveries. We already have the Multiplatform stack that is mature and truly Multiplatform: HTML+JS+CSS If you need something close to the metal, you have C and others that are multiplatform. If you want to do something slightly platform specific you loose the multiplatform claim instantly anyway. IMHO, if you are going to do something that is not an UI to an API or…

With KMP is that you can write all your logic in one language, then reuse that in all platforms, including iOS, Android and Web. That's quite valuable if it works well. I've been trying just that at work with mixed results... The lack of a multiplatform stdlib for pure Kotlin is very tough if you need to do a lot of crypto, various serialization formats etc. so you end up writing lots of multiplatform APIs that are implemented in the respective platform, losing most of the point of using KMP.

I wouldn't want to write the UI also in KMP, though you could do even that if you don't mind using beta software (see https://www.jetbrains.com/lp/compose-multiplatform/).

Using Flutter makes much more sense in that case as nowadays it's very mature, has a huge library and excellent developer UX.

Re: Kotlin Multiplatform for Android and iOS Apps

#30

I’m familiar with phone gap which I believe does this, but is it kosher to have some sort of proxy app that gives you native api calls and otherwise just use a web page? I know you can do something similar with a web view but was curious.

Nah, this is more like React Native than PhoneGap, there’s no webview involved. The Kotlin code is somehow compiled into something that can run on iOS in a native or native-ish way.
Post reply on HN