Using same Go functions for Mobile, web and desktop apps #47
Replies: 2 comments
-
|
Wails is a lightweight alternative to Electron, designed for building desktop applications with a Go backend and a web frontend bundled into a single binary, rather than using a built-in web server to serve web interfaces from Go. In short, to expose the Go backend to the frontend, it auto-generates TypeScript definitions for structs and methods, as well as JavaScript functions for calling them. Github - https://github.com/wailsapp/wails The setup process for a Wails project is extremely simple and as follows-
Dev mode:
Use the build command to compile the binary and save it to the |
Beta Was this translation helpful? Give feedback.
-
|
GO ecosystem provides gomobile, a toolchain, that helps incompiling GO code for mobile clients without rewritting whole logic in swist(for ios) or java(for android). It generates a ".aar" (android archive file, for android) which can run on mobile clients. In short it wraps the GO code into client's compatible language(eg to java classes for android) and helps run GO code on the device. Prerequisites
🔧 InstallationInstall the go install golang.org/x/mobile/cmd/gomobile@latest
go install golang.org/x/mobile/cmd/gobind@latest
Initialise the gomobile Usage gomobile bind -target=android <your-package-name>This generates a .aar file to which can be used on your andorid sdk (for andorid) gomobile bind -target=ios <your-package-name>This generates a .framework file to which can be used on your Xcode(for ios development) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Repeatedly writing same client functionality again and again to make them integrate with different kinds of UIs (Mobile, Web etc) is a confusing task. libr is still looking out for best ways to achieve this. Some of the possible options are wasm, wails and gomobile.
Beta Was this translation helpful? Give feedback.
All reactions