Some cool things are brewing for K/N UI world. Her...
# kotlin-native
b
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)
👍 11
K 12
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
Do you have a repo with the full project?
b
I do, but it's private for now. Happy to give you read access if you drop me your gh handle
p
GTK bindings! Cool. GTK is awesome
a
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
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
(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
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