About this project

swift-adwaita is an imperative Swift 6 wrapper library for GTK4 and libadwaita, designed for building native GNOME desktop applications. It provides 178 widget wrappers—74 auto-generated Adwaita widgets and 104 hand-written GTK widgets—along with a WebView wrapper for WebKitGTK 6.0 (opt-in via the separate AdwaitaWebKit product). The library follows a three-layer architecture: CAdwaita (system library bindings), GObjectSupport (GObject lifecycle management with ARC, signals, Variant, and GValue), and Adwaita (widget wrappers). All raw pointers are hidden behind Swift types, and the public API uses type-safe enums for SignalName, PropertyName, CSSClass, and IconName instead of raw strings. Key features include fluent method chaining for widget configuration, type-safe signal handling with @MainActor closures, async/await support for file dialogs and clipboard operations, keyboard shortcuts with enum-based Key and KeyModifiers, property bindings via GObjectRef.bind(), a unified Container protocol for append/remove operations, and convenience initializers for common widgets like SwitchRow and PreferencesGroup. The library supports menus and actions through GMenuRef and SimpleAction, drag and drop via DragSource and DropTarget, CSS styling with CSSProvider and type-safe CSSClass enums, animations with TimedAnimation and SpringAnimation, drawing with DrawingArea and CairoContext, text attributes for styling labels and entries, media playback with MediaStream and Video, and full localization support including gettext setup, plural and context lookups, runtime language switching, and right-to-left layout. It also provides a @Setting property wrapper for type-safe GSettings binding, adaptive layout helpers with Breakpoint.minWidth() and Breakpoint.maxWidth(), and full Swift 6 concurrency support with @MainActor isolation and Sendable types. The project includes 1194 tests on Linux and 1181 on macOS, 78 demo examples, and CI on Ubuntu and macOS. It requires Swift 6.2+, libadwaita 1.5+ development headers, and GtkSourceView 5 development headers, and supports Linux or macOS 13+ (Apple Silicon recommended). Distribution on Linux is recommended via Flatpak, which uses the GNOME runtime for GTK4 and libadwaita and the Swift SDK extension for the compiler. The library is released under the MIT License.