跳到內容

Mobile Overview

本頁內容尚未翻譯。

Wails v3 runs on iOS and Android using the same main.go and frontend you already write for desktop. There is no separate mobile project, no code-sharing bridge, and no rewrite: the Go binary is compiled for the mobile target and a native WebView renders your existing frontend.

iOS

WKWebView + UIKit host. Assets served via a custom wails:// scheme — no open ports. Requires macOS with full Xcode.

iOS Guide →

Android

Android WebView + WebViewAssetLoader. Go compiled as libwails.so via the NDK. Works on macOS, Linux, and Windows.

Android Guide →

The best way to understand what’s possible is to look at the Kitchen Sink — a single Wails app that runs identically on iOS, Android and desktop from one codebase:

It demonstrates every major mobile API surface across 7 tabs — and it runs on desktop too. The Mobile and Hardware tabs are hidden on desktop via a platform check in the frontend; the Go side registers no handlers for common:* mobile events when built for desktop. This is the recommended pattern for shipping one codebase everywhere.

TabPlatformsWhat it shows
BindingsallJS → Go service calls returning values, structs, and errors
EventsallGo → JS clock, JS → Go → JS ping/pong, OS system events (battery, network, theme)
DialogsallNative message dialogs on each platform
SystemallClipboard, screen metrics, device info
MobileiOS + AndroidShare sheet, keep-awake, torch, brightness, biometrics, local notifications, secure storage
HardwareiOS + AndroidHaptics, geolocation, accelerometer, proximity, text-to-speech
NativeiOS + AndroidiOS: haptics + WKWebView toggles · Android: vibrate + toast

To run it yourself:

Terminal window
git clone https://github.com/wailsapp/wails.git
cd wails/v3/examples/mobile
wails3 task ios:run # iOS Simulator (macOS + Xcode required)
wails3 task android:run # Android Emulator
wails3 task run # Desktop

The same application model applies on every platform:

  1. Go backend — your services, event handlers and application logic compile unchanged for GOOS=ios and GOOS=android.
  2. Frontend — the exact same HTML/JS/CSS. The @wailsio/runtime package works identically; service bindings, events, dialogs and the clipboard all route through the same in-process transport.
  3. WebView host — on iOS a WKWebView inside a UIViewController; on Android a WebView inside an Activity. Wails wires up the message bridge automatically.
  4. In-process asset serving — assets are served directly from Go memory, not a localhost server. No open ports, no loopback, no extra latency.

Platform-specific behaviour lives in files guarded by //go:build ios or //go:build android, keeping your shared code clean.

RequirementiOSAndroid
Operating systemmacOS onlymacOS, Linux, Windows
ToolchainFull Xcode (not just CLI tools)Android SDK + NDK 26.3.x + JDK
Go1.25+1.25+
npm
Verify withwails3 doctorwails3 doctor

Both platforms share the same core feature set:

FeatureiOSAndroid
Service bindings (JS → Go)
Events (both directions)
Message dialogs✅ UIAlertController✅ AlertDialog
Open file dialogs✅ UIDocumentPicker✅ Storage Access Framework
Save file dialogs❌ write to sandbox instead❌ write to sandbox instead
Clipboard✅ UIPasteboard✅ ClipboardManager
Screens / safe-area metrics
Lifecycle eventsevents.IOS.*events.Android.*
HapticsIOS.Haptics.*Android.Haptics.Vibrate
Device infoIOS.Device.Info()Android.Device.Info()
Native tabs (iOS)✅ UITabBar
Toast messages (Android)Android.Toast.Show
Multiple windows❌ first window only❌ first window only
Window geometry / menus / trayintentional no-opsintentional no-ops

Two important rules to know when writing platform-conditional code:

  • ios implies darwin — a file tagged //go:build darwin will also compile for iOS. To target macOS-only, use //go:build darwin && !ios.
  • android implies linux — a file tagged //go:build linux will also compile for Android. To target desktop-Linux-only, use //go:build linux && !android.

At runtime, runtime.GOOS returns "ios" and "android" respectively.

Your First Mobile App

Take a desktop Wails app and run it on iOS Simulator or Android Emulator in minutes.

Get started →

iOS Guide

Full iOS toolchain setup, simulator, device builds, signing, configuration and API reference.

iOS Guide →

Android Guide

Full Android SDK/NDK setup, emulator, APK signing, Play Store packaging and API reference.

Android Guide →