top | item 40397442

Gio UI – Cross-platform GUI for Go

299 points| gjvc | 1 year ago |gioui.org | reply

214 comments

order
[+] DrDroop|1 year ago|reply
Experience report: Impossible to write any serious complex application in this. Lacks components for basic things everyone gets for free on other platforms, things like video, maps or rich text components. Nor does if offer any clear easy path to add them yourself. Breaking API changes every few months. No way to theme something. Immediate mode graphics are great until you need to start managing some complex state, then you are forced to implement your own retainer mode graphics. Again it reintroduces problems that have been solved a long time ago. Very fancy renderer based on piet-gpu that only takes control points of a bezier curve as input and tessellates everything from that. Cool concept, but try drawing a real circle with that, and some some approximation with 4 bezier curves. Wasm is not more then a proof of concept that won't be production ready without years of engineering by compile team. Overall nice for Go developers that wanna do some simple UI with lists and input fields.
[+] gedw99|1 year ago|reply
You can write anything with it.

V0.6 made your issues much less tricky.

Also there is a Material Design theme. And also light and dark.

Here is an excellent example of a gioui app that has light / dark with a custom theme.

https://github.com/chapar-rest/chapar

If you’re on MAC or Windows it’s just “ go run .”.

If you wanted text keening or text sweeping around an arc or RTL / LRT it can do it thanks to github.com/go-text/typesetting

Complex widgets for Calendar spinners or diagrams are out there on GitHub. An effort to bring these together is lacking, and I reckon that if all these things weee brought together it would definitely encourage more developers to dive in.

[+] mort96|1 year ago|reply
> Breaking API changes every few months.

I find this to be the case with a depressing amount of Google code. They do not seem to have a culture which values not breaking their users' code.

[+] neonsunset|1 year ago|reply
If you care about WASM, Uno Platform has decent support for it, there’s also AvaloniaUI and both are stable at this point with relatively rich control collections and libraries.
[+] diskdance|1 year ago|reply
Seemingly it's using a <canvas> to render everything just like Flutter on Web, which is known to have problems with accessibility and feel non-native.
[+] abroadwin|1 year ago|reply
Definitely doesn't feel native or accessible on web. Can't tab between radio buttons. On macOS CMD+A doesn't select all text field text (CTRL+A does).
[+] afavour|1 year ago|reply
I’m curious if anyone has a variant of this idea where an invisible DOM lives alongside the canvas for accessibility reasons. It should work but I imagine it would also take a lot of work.
[+] brirec|1 year ago|reply
Can’t even copy or paste at all on an iPhone.
[+] mort96|1 year ago|reply
I mean it's not primarily a web app framework, it's a native GUI toolkit which has a web back-end.
[+] bsaul|1 year ago|reply
A bit off-topic, but what's the best method to build cross-platform mobile & web apps nowadays ? I'm talking either business logic + UI , or just business logic ?

like gomobile, rust, typescript, etc ?

At some point i thought about using typescript for all business logic, as it seemed the most portable tech, but i realized there's no good way to have decent performance running javascript on iOS.

[+] brabel|1 year ago|reply
The best option is probably Flutter right now: https://flutter.dev/

If you don't mind writing the UI native, sharing only business logic code, Kotlin is an option: https://kotlinlang.org/docs/multiplatform.html#kotlin-multip...

Kotlin also can do the UI if you use Compose: https://www.jetbrains.com/lp/compose-multiplatform/ ... however, iOS support is still in alpha, and Web is "experimental". If you're not willing to cope with that (expect to have to change your code as they develop the framework) then Flutter is the way as it's pretty stable already on all platforms.

If you already know Typescript and React, you may also consider React Native (but I can't attest to its performance on iOS or anywhere else): https://reactnative.dev/

[+] scosman|1 year ago|reply
Native UI for anything that requires polish. I’ve been through too many iterations of frameworks that promise everything and don’t deliver. You’re up and running faster, then soon after you’re patching the core libraries after an OS update to try to get the FPS closer to native, or match a system animation more closely. The time saving only exist if you never polish your UI.

Core logic can be shared. I use gomobile - mostly love it but 3mb overhead for runtime (so not for web). Kotlin multi platform looked good, but I found it missing pretty basic libraries (which exist for Kotlin Android, so no one is building multi platform equivalents). Rust with Mozilla’s language binding layer looks good but I haven’t tried it.

[+] SoKamil|1 year ago|reply
I would say React Native with all the Expo stuff. While Flutter is okayish, web is bad in terms of feel and accessibility since it renders to a canvas. Also, iOS still has issues with lag even after introducing Impeller rendering engine.

Look at Bluesky's client. The app performs decent on all supporting platforms and has single codebase.

https://github.com/bluesky-social/social-app

[+] andsoitis|1 year ago|reply
> what's the best method to build cross-platform mobile & web apps nowadays ?

Uno (https://platform.uno):

* open-source

* targets Android, iOS, Windows, Mac, and Linux (https://platform.uno/platforms/)

* C#

* automatically implements views and controls using each platform's native UI frameworks

* good IDE support: Visual Studio, VS Code, Rider (though you are not limited to those)

* Figma plugin for design collaboration

[+] devjab|1 year ago|reply
We use Tauri, but I think that it’s important to know that we solely use it for internal tools. I have no idea if it’s a good tool for consumer facing products. It works well enough for what we use it for, which is mostly for our solar park technicians where using cross platform Typescript on terrible internet became too much work for our small team.
[+] ludwik|1 year ago|reply
I tried quite a lot of multiplatform frameworks in the context of mobile, and for me Flutter is in a completely different league than the rest of them. I really love it.
[+] Pepe1vo|1 year ago|reply
What's your definition of decent performance?

My company has built quite a few complex capacitor + Angular + Ionic apps and the performance on iOS is fine. Some even got featured by Apple, so that should be some indication that quality and performance was alright.

[+] divan|1 year ago|reply
For the last 4 years the answer is Flutter.
[+] mdhb|1 year ago|reply
Flutter is so far in front of anything else out there I think at the moment.
[+] ricardobeat|1 year ago|reply
My team achieved better than native performance using RN when rewriting a very large iOS app. And that was in 2018, before Hermes and a lot of other optimizations.

It takes some careful usage of requestIdleCallback and avoiding doing work in the UI thread but it is not rocket science. You do have to avoid a lot of the going advice and bloated libraries / frameworks though.

[+] marcusbuffett|1 year ago|reply
I tried React Native, but ended up re-writing and going with SolidJS + Capacitor, and I love the setup. I've barely thought about performance since switching, people think the iOS/Android apps feel native, there's almost never any differences in behavior between the platforms, it's a fantastic setup for a solo dev.
[+] petesergeant|1 year ago|reply
I’m getting on pretty well with Ionic + TypeScript, using React and Redux. Performance hasn’t really been an issue, although I’m also not doing anything that performance heavy. I’d recommend it. I like that it ends up being comprehensible HTML + CSS, as well as simple React that I’m already comfortable with and can debug.
[+] bossyTeacher|1 year ago|reply
You already answered your own question imo. The web is the best thing we have so far and nothing comes closer to the full package. It literally is write once and write everywhere.

All the other alternatives are young frameworks that have not been battle tested and have weird quirks once you want anything relatively complicated.

[+] raminf|1 year ago|reply
For mobile, this looks promising: https://skip.tools

Transpiles SwiftUI over to Kotlin/JetPack Compose. Native all the way down. Haven't used it in production, but the demos work and are native after going through XCode and Android Studio.

[+] felipefar|1 year ago|reply
I would mention as an alternative QML, although I wouldn't claim it is the "best method". It's marketed as being mobile-capable, but I've heard problems about scrolling inertia and vsync delays.

I'm curious to know what others think about it.

[+] gedw99|1 year ago|reply
Have been using gioui to build streaming apps. It’s very easy and upgrading is always easy because it’s golang and the core devs take it seriously when they make a change.

When I need a web gui I use a gioui plugin system here: https://github.com/gioui-plugins/gio-plugins

WebViews work on web, desktop and mobile. It’s amazing. Deep linking also so you can send out a link to an email or Monike notification and the users app will open the gio gui in the right part of the gui.

It also has notifications and share extensions for all OS’s. It’s really a complete system. I can’t believe how much devs complain about things not being easy , when it’s all there. I definitely share the feelings that’s it’s so hard to support so many OS’s, but it’s the world we live in - plurality.

I like how I can do all of this with only golang , instead of switching between bits and bobs.

I always write my golang backend to work with gio and html.

So if I need SEO or video playback I can still do it in a web view and also keep googles seo happy for the gio web. I just use Hugo and feed it markdown. This is what Google SEO sees.

[+] shikaan|1 year ago|reply
Go newbie here. Can anybody elaborate on this piece of the docs?

""" You might be thinking that it would be more usual to have an ops.Add(ColorOp{Color: red}) method instead of using op.ColorOp{Color: red}.Add(ops). It’s like this so that the Add method doesn’t have to take an interface-typed argument, which would often require an allocation to call. This is a key aspect of Gio’s “zero allocation” design. """

Why would there be an allocation? Of what? How are we saving it?

[+] flohofwoe|1 year ago|reply
Interesting that the WASM demo on the front page just render a black rectangle where the text is supposed to be on my fairly vanilla Windows 10 PC with Chrome (it rendered fine in Chrome on my Android phone).
[+] 999900000999|1 year ago|reply
I built a small app in Go using Fyne.

Never again. Both Gio and Fyne lack tons of polish and features Flutter provides.

I built my core logic in Golang, and then decided to wrap it in an Android app. The GUI feels like it came out of 2003 with limited ways to fix it.

[+] PhilippGille|1 year ago|reply
A different option is Wails [1], which allows you to write all logic in Go, and the UI in HTML (with any or no web framework). It's like Electron but lighter because it doesn't ship Chrome but uses the system's web viewer instead.

[1] https://github.com/wailsapp/wails

[+] saganus|1 year ago|reply
Sounds interesting. How did you wrap it in an Android app if you could elaborate?
[+] andreygrehov|1 year ago|reply
Why do all these cross-platform GUIs look like they were designed 50 years ago?
[+] okasaki|1 year ago|reply
The demo doesn't work for me. I see some buttons but mostly it's all black. Chromium on Win 11.
[+] oefrha|1 year ago|reply
It's a good sign that unlike fyne, this library passed the very first test I threw at it: rendering some CJK text. Fyne can't do that unless you give it one custom font to render everything in — well, good luck finding one satisfactory font encompassing all commonly used scripts around the world, not to mention emojis. Which means fyne is immediately dead to me whenever I'm building anything with a remote chance of user-generated/web content and/or localization.
[+] maccard|1 year ago|reply
Noto sans is pretty good in this regard.
[+] cabalamat|1 year ago|reply
I note form the demo that there's a "Flat" button that looks like normal text. This is a mis-feature and should be removed; controls should look different from things you can't interact with.
[+] gjvc|1 year ago|reply
strongly agree
[+] andsoitis|1 year ago|reply
doesn't appear to support Unicode.
[+] anon-3988|1 year ago|reply
How does this compare with Fyne?
[+] glass-z13|1 year ago|reply
Yet non of the GUI libraries/frameworks for GO support drag/drop file to get the real path
[+] w1nst0nsm1th|1 year ago|reply
Blazor is cross-platform, in combo with MAUI.NET
[+] shrubble|1 year ago|reply
The amazing thing is that 30 years ago there were cross platform toolkits like Neuron Data and the toolkit under OpenOffice(called StarOffice originally), and yet today the options are still fragmented and imperfect.

We have far better compilers and even languages for cross-platform work, so it should be easier by now.

[+] luismedel|1 year ago|reply
Not about Gio UI but related.

I'm really enjoying the conversation around UI toolkits here. But I think we're all missing the elephant in the room and it's that we already had (have?) a superb toolkit and development model in the Visual Basic (later Windows Forms) era and nothing really manages to replicate that experience nowadays.

Microsoft destroyed it when they tried to push WPF and later shenanigans, only to realize it was a mistake years later.

I can't understand why we all, as a sector, agree about standards being a good thing, even if some are only de facto, and never agreed to maintain that really simple model.

I remember Mono tried to bring that to all platforms and everybody ignored/smashed them because "it's Microsoft".

Edit: typo