https://kotlinlang.org logo
Title
b

Big Chungus

04/14/2023, 12:14 PM
Some cool things are brewing for K/N UI world. Here's a little demo of GTK4 app on LinuxX64 build with kotlin native! All the credits go to @vbsteven and friends. Keep an eye out! (all the code in the thread)
main.kt.cpp
Key things being showcased in the video: • GTK Widgets (Application, Window, Button, Label, Switch) • Window widget is subclassed with custom init logic encapsulated • Mutable state and event handling to update it (buttons) • State binding between widgets (switches) • Persistent state saving and loading (window size and first switch state)
v

vbsteven

04/14/2023, 12:48 PM
Do you have a repo with the full project?
b

Big Chungus

04/14/2023, 12:52 PM
I do, but it's private for now. Happy to give you read access if you drop me your gh handle
p

Pablichjenkov

04/14/2023, 2:18 PM
GTK bindings! Cool. GTK is awesome
a

Arkadii Ivanov

04/15/2023, 11:50 AM
Nice! Thanks for sharing! Do you see any value of having a navigation library for K/N (e.g. for linuxX64)? I've got a feature request to add support of linuxX64 to Decompose, but I'm not sure how much this would be useful.
b

Big Chungus

04/15/2023, 11:51 AM
No idea, I've just started exploring it with hopes of building gtk-compose. So far I only have a semi-working PoC that's able to generate static layout tree (no props or events in compose layer just yet)
v

vbsteven

04/15/2023, 3:48 PM
(co-author of the underlying bindings here) I'm working on a similar higher level library on top but I'm actually going for an MVC model instead of reactive/compose. Mostly because IMHO reactive does not work well with the underlying statefulness of GTK.
@Arkadii Ivanov what would a K/N navigation library look like?
a

Arkadii Ivanov

04/15/2023, 4:57 PM
You can check the docs - https://arkivanov.github.io/Decompose/navigation/overview/ Basically, there is the core
decompose
module that doesn't depend on any UI framework. We could add linuxX64 target support as well. Then you can plug any UI externally, like it already works with Compose/SwiftUI/React/etc. You observe the navigation state, and update the UI accordingly, removing unnecessary views and adding new ones. This means a single-window navigation. However, I have a feeling that window-based navigation would be preferable? Single-window navigation could be useful in a multiplatform app with shared navigation. Here is the feature request - https://github.com/arkivanov/Decompose/issues/345