I was wondering if Kotlin desktop is robust/comple...
# announcements
l
I was wondering if Kotlin desktop is robust/complete enough to write a full desktop (macOS/Windows) app with? I haven't seen many example projects online and the documentation is non-existent. Should I give it a go? if not, does anyone have any experience with electron with Kotlin Js?
r
Haven't used compose for desktop, but you can build electron apps with Kotlin/JS and KVision. https://kvision.gitbook.io/kvision-guide/part-2-advanced-features/building-with-electron
l
Will check it out, thanks 🙂
c
There are several different ways to use Kotlin on desktop: A normal Java Swing app written in Kotlin, Tornado FX (Kotlin wrappers over Java FX) #C136UUPE1, Compose for Desktop (which itself is running on Swing) #C01D6HTPATV. Swing and Tornado FX are old, robust, well-established ways to build desktop apps. I’m pretty sure any Java-based desktop app will consume less system resources than an Electron app. Compose is still in beta, but in my experience is absolutely capable of building robust desktop applications, and is going to be a very strong contender for desktop apps in the near future. Compose only handles the UI layer, so you’re left to manage the application/window lifecycle for yourself
👍 2
l
Kotlin compose for desktop looks like what I'd like to learn and use, my only difficulty is the lack of resources online on the subject. I haven't explored it on Android either so it's pretty much new to me.
r
You can also check this series of articles: https://blog.frankel.ch/state-jvm-desktop-frameworks/1/
👍 1
c
👆That is a very good series of articles, I highly recommend reading them all.
👍 1
l
Thank you both, I'll check everything out👍
c
That said, @Liad Mazor, the nature of Compose is that it really doesn’t need nearly as much documentation as most other UI frameworks. The way it’s built, there’s a handful of “primitives” that are used in the exact same way for pretty much every UI component, and once you understand how to use those primitives, it’s just a matter of finding the widgets you want and applying what you know. You don’t need to learn subtle differences in APIs for different widgets, because they all work in the same way. All the documentation here https://developer.android.com/jetpack/compose/ is really all you need, plus the Desktop-specific bits in the
compose-jb
repo https://github.com/JetBrains/compose-jb. Especially the docs in the “Foundation” and “Design” sections of the Android docs, and then just start building and things will start to make sense, especially if you pair it with the Decompose library for managing component lifecycles https://github.com/arkivanov/Decompose
👍 1
l
Excellent, I'm quite new to UI frameworks and hopefully I'll get the hang of it quickly. Both of you have been great help and I have my work cut out for me
t
@Liad Mazor Here's something that am building with Compose Desktop : https://github.com/theapache64/stackzy
y
I just want to chime in because I have also been building a compose desktop app. It is hard to get into. I have been struggling... a lot. I think the hardest is that it is also a complete paradigm shift from other common frameworks (Swing, AWT, etc...) as it embraces a more functional/reactive way of programming. If you are familiar with React it might be easier to start. If you only know Swing or equivalent it will be harder. Another struggle is that it is really alpha and it shows. Sometimes things just stop working (like clicking on a card expand/contract my card) and for some reason that doesn't work anymore. Then you spend time trying to wonder whether your code is using the right sprinkling of
remember
/
mutableStateOf
... and in the end it is some random issue in the framework as restarting the app makes the problem magically go away. Although this sound negative I do enjoy it a lot ;)