Cross-Platform UI Framework

Build once, run everywhere with Swift

Shaft brings Flutter's elegant design to Swift's native performance. One codebase for desktop, mobile, and web.

Supports Major Platforms

macOS

Linux

Windows

Web

iOS

Android

main.swift
import Shaft
import Observation

@Observable class Counter {
    var count = 0
}

let counter = Counter()

class CounterView: StatelessWidget {
    func build(context: BuildContext) -> Widget {
        Column {
            Text("Count: \(counter.count)")
            
            Button {
                counter.count += 1
            } child: {
                Text("Increment")
            }
        }
    }
}

runApp(CounterView())

Why Shaft?

Combining proven concepts from Flutter with Swift's native performance

Simple & Hackable

Just a regular Swift package - no build infrastructure or special toolchain required. Easy to customize and extend.

Effortless State Management

UI automatically syncs with data changes. No manual state management, no boilerplate - just mark data with @Observable and it works.

Lightning Fast

Native performance with ARC-based memory management. Built with Swift for optimal speed and efficiency.

Hot Reload

Cross-platform hot reload solution enables real-time changes without restarting your application. See changes instantly.

Native Multi-Threading

True native threading with Swift's concurrency model. Built for demanding workloads with direct access to low-level graphics APIs.

Platform API Access

Access platform APIs and rendering engines directly. No message channels or FFI bridging - just native Swift interop.

Try Shaft Online

Experiment with Shaft directly in your browser using our interactive playground

Playground

Get Started

Get up and running with Shaft in minutes

Installation

macOS

Install Xcode from the App Store

Linux

Install Swift and SDL dependencies:

sudo apt install ninja-build pkg-config libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev libusb-1.0-0-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev libunwind-dev libpipewire-0.3-dev libdecor-0-dev libfontconfig-dev

Windows

Install Swift stable release

Create Your First App

# Clone the template
git clone https://github.com/ShaftUI/CounterTemplate.git

# Navigate to directory
cd CounterTemplate

# Run your app
swift run

Hot Reload, Instantly

See your changes in real-time without restarting your app. SwiftReload works on macOS and Linux.

CounterView.swift
 {
    Text("Hello")
    Text("World")
}

Change Row to Column - layout updates instantly

App Preview
Hello
World

Instant Updates

Changes appear in milliseconds without app restart

Cross-Platform

Works on macOS and Linux, Windows coming soon

No Dependencies

Pure Swift solution, no Xcode or special toolchain required