Write SwiftUI, run anywhere.
A cross-platform SwiftUI framework that renders natively on macOS, Linux, Windows, and the Web — from a single Swift codebase.
| macOS (SwiftUI) | Linux (GTK4) |
|---|---|
![]() |
![]() |
| Windows (Win32) | Web (Wasm) |
![]() |
![]() |
Same Swift code. Native rendering on each platform. No electron, no webview wrappers.
A MacPaint-class drawing app with pencil, eraser, line, rectangle, and ellipse tools. Demonstrates Canvas rendering, Path-based drawing, drag gestures, and undo/redo — all from a single main.swift.
| Platform | Backend | Status | Views | Modifiers |
|---|---|---|---|---|
| macOS | SwiftUI (native) | Reference | All | All |
| Linux | GTK4 | Stable | 43/44 | 36/38 |
| Windows | Win32 + D2D | Stable | 43/44 | 36/38 |
| Web | Wasm + DOM | Near-parity | 42/44 | 36/38 |
| Android | Compose | Suspended | 14/44 | 22/38 |
SwiftOpenUI now tracks parity at two levels:
| Doc | Purpose |
|---|---|
| Feature Parity Matrix | Backend-by-backend behavior status for SwiftUI features, with notes for GTK4, Win32, Web, and Android |
| API Implementation Tracker | SwiftUI API-surface coverage, availability, and current vs partial vs missing status by feature family |
Use the matrix when you want to know how a feature behaves on a specific backend. Use the implementation tracker when you want to know whether a SwiftUI view or modifier family exists in SwiftOpenUI at all.
Current examples:
.searchable()is implemented on GTK4, Win32, and Web, with fallback-level placement and lightweight token/suggestion/scope UI documented in the matrix..safeAreaInset()and.safeAreaPadding()exist on GTK4, Win32, and Web, with synthetic or partial backend behavior documented in the matrix..toolbar()and.sheet()have working GTK4, Win32, and Web support, while the tracker shows which overload families are implemented vs still pending.
Android work is currently suspended. Existing Android rows remain in the parity docs for reference, but active parity work is focused on GTK4, Win32, and Web.
# Clone
git clone https://github.com/codelynx/SwiftOpenUI.git
cd SwiftOpenUI
# Run on macOS (uses real SwiftUI)
swift run HelloWorld
swift run Stopwatch
swift run ColorMixer
swift run SimplePaint
# Run on Linux (GTK4)
sudo apt install libgtk-4-dev
swift run ColorMixer
# Run in browser (Wasm)
./web/run.sh ColorMixerFor detailed per-platform setup (prerequisites, toolchains, Vite, GTK4 packages, Visual Studio), see the Getting Started Guide.
Polished mini-apps demonstrating what you can build:
| Example | Command | Description |
|---|---|---|
| HelloWorld | swift run HelloWorld |
Minimal app — Text with padding |
| Stopwatch | swift run Stopwatch |
Timer, start/stop, lap times |
| ColorMixer | swift run ColorMixer |
Color picker with sliders, swatches, harmony |
| Calculator | swift run Calculator |
Grid/GridRow calculator with arithmetic logic |
| SimplePaint | swift run SimplePaint |
Drawing app with tools, color palette, undo/redo |
Matrix-backed coverage screens — one per feature category:
swift run ParityViewsBasic # Text, Button, TextField, Color, Spacer, Divider
swift run ParityViewsLayout # VStack, HStack, ZStack, ForEach, Group
swift run ParityViewsContainers # Toggle, Slider, Image, ScrollView, List
swift run ParityModifiers # padding, frame, colors, font, border, opacity
swift run ParityStateData # @State, @Binding, @ObservedObject, @StateObject
swift run ParityNavigation # NavigationStack, NavigationLink, NavigationPath
swift run ParityEnvironment # @Environment, @EnvironmentObject, custom keys
swift run ParityGestures # onTapGesture, onLongPressGesture, onDrag
swift run ParityAnimation # .animation(), withAnimation()
swift run ParityFocus # @FocusState, .focused()
swift run ParityAppStructure # App, Scene, WindowGroup, @ViewBuilderText, Button, TextField, Toggle, Slider, Image, Color, Spacer, Divider, VStack, HStack, ZStack, Group, ForEach, List, ScrollView, AnyView, EmptyView, NavigationStack, NavigationLink, SecureField, TextEditor, ProgressView, Stepper, Label, Link, TabView, Grid, GridRow, DisclosureGroup, Form, Section, LazyVStack, LazyHStack, LazyVGrid, LazyHGrid, Picker, DatePicker, GeometryReader, Menu, ConfirmationDialog, Canvas, NavigationSplitView, Path
.padding(), .frame(), .foregroundColor(), .foregroundStyle(), .background(), .font(), .border(), .opacity(), .offset(), .scaleEffect(), .animation(), .imageScale(), .onTapGesture(), .onLongPressGesture(), .onDrag(), .environmentObject(), .environment(), .navigationTitle(), .navigationDestination(), .focused(), .modifier(), withAnimation(), .cornerRadius(), .shadow(), .rotationEffect(), .overlay(), .sheet(), .alert(), .confirmationDialog(), .onAppear(), .searchable(), .toolbar(), .gridCellColumns(), .pickerStyle(), .navigationSplitViewColumnWidth(), .onDisappear()
@State, @Binding, @ObservedObject, @StateObject, @EnvironmentObject, @Published, @Environment, @FocusState, @Observable, ObservableObject
+-----------------------------------------------------+
| Examples (import SwiftUI on macOS, SwiftOpenUI else)|
+-----------------------------------------------------+
| SwiftOpenUI Core |
| View, State, Layout, Modifiers, Environment |
+--------------+---------------+---------------+-------------+
| BackendGTK4 | BackendWin32 | BackendWeb | BackendDroid|
| GTKRenderer | WinRenderer | WebRenderer | AndroidRend.|
| GTKViewHost | Win32ViewHost| WebViewHost | AndroidHost |
+--------------+---------------+---------------+-------------+
| CGTK | CWin32 | JavaScriptKit| JNI |
| CGTKBridge | CWin32Bridge | (DOM API) | Compose |
+--------------+---------------+---------------+-------------+
The core library (Sources/SwiftOpenUI/) is platform-independent with zero platform imports. All GTK/Win32/Web code lives in Sources/Backend/. Backends implement rendering via protocol extensions (GTKRenderable, WinRenderable, WebRenderable).
| Platform | Prerequisites | Build | Test |
|---|---|---|---|
| macOS | Xcode CLI tools | swift build |
swift test |
| Linux | libgtk-4-dev |
swift build |
swift test |
| Windows | Swift toolchain | swift build |
swift test |
| Web | swiftly + Wasm SDK | ./web/run.sh HelloWorld |
N/A |
brew install xcodegen
cd apple/Examples && xcodegen generate
open Examples.xcodeproj| Doc | Description |
|---|---|
| Feature Parity Matrix | Per-backend implementation status |
| API Implementation Tracker | SwiftUI API-surface coverage and generated feature-family status |
| Running Examples | Build and run on all platforms |
| Adding a Backend | How to implement a new backend |
| Web Setup | Wasm build, Vite, DOM mapping |
| Platform Notes | Platform quirks and workarounds |
| Web Parity Plan | Web backend gap analysis |
- Pick a view or modifier from the parity matrix
- Add the core definition in
Sources/SwiftOpenUI/Views/orModifiers/ - Add backend rendering in each renderer (see adding a backend)
- Add tests in
Tests/SwiftOpenUITests/ - Add coverage to the appropriate parity example
MIT License. See LICENSE for details.




