Gio implements portable immediate mode GUI programs in Go. Gio programs run on all the major platforms: iOS/tvOS, Android, Linux (Wayland), macOS, Windows and browsers (Webassembly/WebGL).
Gio includes an efficient vector renderer based on the Pathfinder project (https://github.com/pcwalton/pathfinder). Text and other shapes are rendered using only their outlines without baking them into texture images, to support efficient animations, transformed drawing and pixel resolution independence.
Gio is designed to work with very few dependencies. It depends only on the platform libraries for window management, input and GPU drawing.
With Go 1.13 or newer, initialize a new module and run
$ go mod init example.com $ go run gioui.org/example/hello
should display a simple message in a window.
$ go run gioui.org/example/gophers
runs another example that displays Go contributors fetched from GitHub.
For Android, iOS, tvOS the
gogio tool can build and package a Gio program for you.
To build an Android .apk file from the
$ go run gioui.org/cmd/gogio -target android gioui.org/example/gophers
The apk can be installed to a running emulator or attached device with adb:
$ adb install gophers.apk
gogio tool passes command line arguments to os.Args at runtime:
$ go run gioui.org/cmd/gogio -target android gioui.org/example/gophers -token <github token>
-appid flag specifies the iOS bundle id or Android package id. The flag is required
for creating signed .ipa files for iOS and tvOS devices, because the bundle id must match an id
previously provisioned in Xcode. For example,
$ go run gioui.org/cmd/gogio -target ios -appid <bundle-id> gioui.org/example/gophers
Window->Devices and Simulators option in Xcode to install the ipa file to the device.
If you have ideviceinstaller installed,
you can install the app from the command line:
$ ideviceinstaller -i gophers.ipa
If you just want to run a program on the iOS simulator, use the
-o flag to specify a .app
$ go run gioui.org/cmd/gogio -o gophers.app -target ios gioui.org/example/gophers
Install the app to a running simulator with simctl:
$ xcrun simctl install booted gophers.app
To run a Gio program in a compatible browser, the
gogio tool can output a directory ready to
serve. With the
goxec tool you don't even need a web server:
$ go run gioui.org/cmd/gogio -target js gioui.org/example/gophers $ go get github.com/shurcooL/goexec $ goexec 'http.ListenAndServe(":8080", http.FileServer(http.Dir("gophers")))'
Open http://localhost:8080 in a browser to run the program.
See the integration guide for details on using Gio with existing projects.
Post discussion and patches to the mailing list. No Sourcehut account is required and you can post without being subscribed.
See the contribution guide for more details.
Dual-licensed under UNLICENSE or the MIT.
Bitcoin donations are gladly accepted to bc1q8xw95urett00f4xs3v66p2l6xp2mfk5erpe5ug. Donations will go toward hosting expenses and for supporting the author's full time work on Gio.