Live data from Hacker News

Kotlin Multiplatform for Android and iOS Apps

rockandnull.com

61–70 of 82 posts

Re: Kotlin Multiplatform for Android and iOS Apps

#61
post #24

I haven’t yet tried KMP, but I think Kotlin in general is slept on here on HN. My experience is on the server side with both Micronaut and Spring Boot and it’s such an ergonomic language to write in. It’s probably my favorite language thus far.

It’s a great language but it hasn’t really found a killer app yet outside of Android development and Java has improved a lot recently so the incentive to switch to Kotlin is reduced.

I’d like to see it thrive but I’m not optimistic.

Re: Kotlin Multiplatform for Android and iOS Apps

#62
post #58

Earlier quoted context omitted.

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 unl…

The JVM’s biggest feature is all the millions of great quality packages it has.

I agree, but the subset of those that's relevant to mobile (Android, and with KMM, iOS) development often has KMM-compatible counterparts. The exceptions to that would be libraries that rely on runtime reflection heavily (serialization libraries for example), those are mostly replaced with libraries that work statically and/or code generation via KSP.

Re: Kotlin Multiplatform for Android and iOS Apps

#63

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…

Its trying to be everything, but its good at nothing. Even with spring boot, it has a painful edges.

Learning a language isn't a huge burden. Frameworks and libraries can alleviate huge burdens. Kotlin avoids the benefits of frameworks and libraries while giving meager benefits in term of language constructs.

Re: Kotlin Multiplatform for Android and iOS Apps

#64
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…

It's only hard to understand if you regard html, js, and css as good enough. It's the reason why people prefer native development on mobile. Standards are a bit different there than on the web and the space is more competitive.

Kotlin multiplatform and compose multiplatform are about leveling the playing field a bit and giving developers more choices than this one size fits all straight jacket that is the "modern" web (I use the word modern loosely here).

And it allows people targeting mobile to target other platforms with their code bases. If it's valid to use the web on mobile, then why not use mobile frameworks on the web?

Re: Kotlin Multiplatform for Android and iOS Apps

#65

Earlier quoted context omitted.

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 c…

Don't forget C#/F#. Microsoft's been leaning hard into cross-platform with MAUI.

[flagged]

Re: Kotlin Multiplatform for Android and iOS Apps

#66
post #29

Earlier quoted context omitted.

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 i…

Yeah, the library ecosystem for KMM is lacking. Also the build system used to be a headache. I haven't tried KMM recently but it was so unintuitive a year back

It actually improved a lot. There are a lot of pretty decent multiplatform libraries out there. I've developed a few myself. It's pretty easy and straightforward. You are right that the tools were a bit rough a year ago. But they worked. I've been developing kotlin-js and multiplatform stuff since 2020. Definitely very cutting edge back then and not for the faint hearted. But our bet worked out and we now have a nice thriving business and a maintainable code base.

In fairness, KMM and KMP are still in beta and the compiler has been in the process of being overhauled. That's a process that is nearly completed but it is still ongoing. Having used the new k2 compiler with kotlin-js, it's a big upgrade in terms of performance. I expect a lot of stuff to start stabilizing post Kotlin 2.0, which should be out in later winter/spring next year. 1.9.10 is the current release. 1.9.20betas are already out. There might be a .30 but the release after that is basically 2.0. 3-6 months out basically if Jetbrains sticks to their normal release schedule.

IOS support in Compose Multiplatform is alpha quality. You shouldn't use it for anything important. But when it is done, you can expect to be able to develop applications with one code base that run nicely on Android, IOS, the web, or on desktops.

Compose web is actually targeting the new wasm compiler. Which of course is also alpha. That's an interesting one because it uses the WASM standardize GC facilities. That's currently out in browsers already but hidden behind feature flags. Which are very likely to come off soonish.

Give it a year or two. Too early to write it off now when it is basically all early access and alpha/beta quality. IMHO, there is some good tech coming together there.

Re: Kotlin Multiplatform for Android and iOS Apps

#67

Earlier quoted context omitted.

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…

The idea is you can write SwiftUI on iOS, whilst connecting to business logic written in Kotlin.

Sort of but not really. SwiftUI is reactive, with view changes triggered by changes in Swift variables and those changes triggered using Combine. The later iterations of Swift include async/await to greatly simplify async code (normally but not always focused on network endpoints). You can write everything you need without having to drag Kotlin into the mix, and including Kotlin will require bridge code that seems (to me, at least) an unwanted obligation just to let some executive say "We saved some money by sharing code!".

Re: Kotlin Multiplatform for Android and iOS Apps

#68
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 unl…

Spoiler alert: We (iOS developers) don't.

Re: Kotlin Multiplatform for Android and iOS Apps

#69
post #42

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 use Kotlin daily at my job (I have to) and I'm not impressed. It is a new language that ignores most of the innovations in Programming Language Theory from the last 20 years. It only improves on Java by making the syntax less verbose and adding coroutines but almost doesn't add any benefits in terms of semantics.

It's ok everyone, they must misspelled Go as Kotlin

Re: Kotlin Multiplatform for Android and iOS Apps

#70

Earlier quoted context omitted.

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 c…

Don't forget C#/F#. Microsoft's been leaning hard into cross-platform with MAUI.

Hot take: Microsoft can't do good UI frameworks and it shows. XAML makes some things really hard, resulting in loads of ValueConverters for example. Part of my bad experience might just be the learning curve but honestly I'm not surprised so much software is built using Electron.
Post reply on HN