Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with Jetbrains Compose #40

Open
brianguertin opened this issue May 11, 2021 · 8 comments
Open

Integrate with Jetbrains Compose #40

brianguertin opened this issue May 11, 2021 · 8 comments

Comments

@brianguertin
Copy link

brianguertin commented May 11, 2021

I noticed in this project's README that you weren't sure about the DSL.

Well, what if we changed the DSL over to Android/Jetbrains Compose? It seems like fun idea because:

  • Take advantage of the tree-building and reactivity built into compose
  • Compose is gaining traction & mind-share, so this project might be more approachable by sharing concepts
  • Improved code sharing; e.g. you could use expect/actual to build common interfaces that work across both Android and native desktop.
  • Jetbrains is already working on Compose Desktop, but some devs (myself included) disapprove of using Skia canvas instead of native platform widgets for reasons of accessibility/etc.. Plus, it's on the JVM and not Kotlin/native. So we could create a nice alternative to fill a different niche.

I'm just brainstorming, but I'm hoping to have some time to explore this myself, thought the idea was worth sharing.

@msink
Copy link
Owner

msink commented May 11, 2021

Yes, I do have plans to move in that direction :)
When project was created it declared as long-term plan to move in TornadoFX direction, but now - Compose is far more promising, yes.

Maybe as first step - just mimic Compose-UI API as much as possible, on top of libui C API.
Later, when compose-runtime and compiler-plugin will support K/N - try to integrate more deeply.

But as always I'm too not sure if I will have time for that, so of course PR's are very welcome :)

@brianguertin
Copy link
Author

brianguertin commented May 14, 2021

Yeah, well Jetbrains just announced Kotlin/JS Compose for Web, so they are putting the work in to support multiplatform. I'm hoping to see Jetbrains start an iOS port too, because that would be awesome, and would bring first-class support for Compose on Kotlin/Native. Maybe some day 🤞

@brianguertin
Copy link
Author

Looks like as of May 28th this is technically possible: https://twitter.com/shikasd_/status/1398445030419877891?s=20

Though, there are no prebuilt artifacts published for native (yet?)

@songdehuai
Copy link

Is it possible to use LVLG .https://github.com/lvgl/lvgl

@msink
Copy link
Owner

msink commented Feb 10, 2022

LVGL is somewhat similar to compose-ui, yes - both implement all widgets by drawing them on plain canvas (framebuffer).
libui uses widgets from native OS API.

Totally different philosophy:

  • LVGL/compose-ui look and feel is same on all systems, but differs from other programs on that system.
  • libui on contrary - look different on every system - but similar to other programs.

If this project ever will use compose (still possible, but unsure) - it will be low-level compose runtime, and maybe layout framework.
But not widgets. Drawing widgets on canvas is out of scope for this project.

@e13mort
Copy link

e13mort commented Aug 20, 2023

I think Compose is a great way to move.

  • It's designed to separate UI draw logic from runtime & layout logic. https://github.com/JakeWharton/mosaic is a good example of that concept. Compose for HTML is another.
  • Compose Runtime has good interoperability with Kotlin Coroutines. Supporting it will allow one to create fully multiplatform applications natively for all major OSs. KMP + Compose UI for Android, KMP + Swift UI for iOS, KMP + Composed libui for Mac, Win & Linux

@Dominaezzz
Copy link

Seeing your comment caught my attention and I've started throwing together a POC/MVP.
I've managed to start up a window with a single label with compose!
I'll quickly port over ktx widgets and make a draft PR in a couple days.
It won't be tidy enough to merge as is but at least the bulk of the hard work would be done.

@Dominaezzz
Copy link

Made a PR. Take a look and give it a go. Lemme know if you encounter any bugs/crashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants