A cross-platform GUI framework for Swift, built for demanding workloads and developer ergonomics

Shaft is a cross-platform UI framework designed for high-performance applications with a focus on simplicity and customizability.
A blog post introducing Shaft in details has been posted here.
New✨: Shaft now natively supports multi-window. Check out the Multi Window demo for more details.
MacOS:
Shaft requires Xcode to be installed. After installing Xcode, if you encounter errors like xcrun: error: unable to lookup item..., try update your command line tools following these instructions.
Linux:
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 following the official guide shoube be enough.
git clone https://github.com/ShaftUI/Shaft.git
cd Shaft
swift run Playground
These commands will launch the built-in Playground application, which serves as both an interactive demonstration and comprehensive documentation for the Shaft framework.
To create a new project with Shaft, the CounterTemplate is a good starting point.
A cross-platform hot reload solution is developed along with Shaft, enabling developers to see changes in real-time without restarting the application. Simply follow the instructions in the SwiftReload or clone the CounterTemplate to get started.
No build infrastructure or special toolchain required - just a regular Swift package containing both engine and framework, makes it easy to customize, extend, and adapt to your specific needs.
Built for demanding workloads with native multi-threading support, direct low-level graphics API access, and deterministic memory management through ARC. Scales effortlessly from simple apps to complex, resource-intensive applications.
Shaft’s modular design enables integration of custom backends and renderers without much effort. This flexibility allows for unique use cases like terminal-based UI or creating Wayland compositors, enabling developers to adapt the framework for specialized use cases.
Data marked with @Observable enables automatic UI updates when values change. The framework automatically tracks these objects and efficiently refreshes only the affected UI components, eliminating the need for manual state management and reducing boilerplate code. This reactive approach ensures your UI stays synchronized with your data in a performant way:
@Observable class Counter {
var count = 0
}
let counter = Counter()
class CounterView: StatelessWidget {
func build(context: any BuildContext) -> any Widget {
Column {
Text("Count: \(counter.count)")
Button {
counter.count += 1
} child: {
Text("Increment")
}
}
}
}
Shaft is fast from the beginning as it combines Flutter’s design with Swift’s native performance. And by leveraging ARC based memory management it uses as little memory as possible.
The benchmark was conducted on a 2021 MacBook Pro with Apple M1 Max processor and 64 GB of RAM.

More documentation can be found in the Playground app.