A framework for creating user interfaces for GNOME with an API similar to SwiftUI https://adwaita-swift.aparoksha.dev/
Go to file
2024-03-31 19:59:00 +02:00
.github Add workflow for DocC docs 2024-03-31 19:59:00 +02:00
Documentation/Reference Support modifying a window's instance inside views 2024-02-26 22:53:34 +01:00
Icons Add docc documentation 2024-03-29 23:04:37 +01:00
Sources Simplify focused modifier 2024-03-31 13:00:03 +02:00
Tests Add support for setting a dialog's width & height 2024-03-21 09:40:58 +01:00
user-manual Fix instructions for macOS 2024-03-29 11:29:57 +01:00
.gitignore Initial Commit 2023-09-12 08:17:52 +02:00
.spi.yml Add docc documentation 2024-03-29 23:04:37 +01:00
.swiftlint.yml Add docc documentation 2024-03-29 23:04:37 +01:00
CONTRIBUTING.md Add support for auto-generated widget bindings 2024-01-22 21:45:31 +01:00
Contributors.md update docs with macos platform 2024-03-27 18:06:36 -04:00
LICENSE.md Add support for auto-generated widget bindings 2024-01-22 21:45:31 +01:00
Makefile Initial Commit 2023-09-12 08:17:52 +02:00
Package.swift Add support for older macOS versions 2024-02-27 06:24:48 +01:00
README.md Add link to blog post 2024-03-26 07:25:03 +01:00
SUMMARY.md Add instructions for publishing apps 2024-03-07 06:36:24 +01:00

Adwaita Icon

Adwaita for Swift

User Manual · GitHub · Contributor Docs

Adwaita is a framework for creating user interfaces for GNOME with an API similar to SwiftUI.

The following code:

struct Example: View {

    @State private var count = 0

    var view: Body {
        Text("\(count)")
            .style("title-1")
            .padding(50)
            .topToolbar {
                HeaderBar.start {
                    Button(icon: .default(icon: .goPrevious)) {
                        count -= 1
                    }
                    Button(icon: .default(icon: .goNext)) {
                        count += 1
                    }
                }
            }
    }

}

Creates a simple counter view:

Counter Example

More examples are available in the demo app:

Demo App

Table of Contents

Goals

Adwaitas main goal is to provide an easy-to-use interface for creating GNOME apps. The backend should stay as simple as possible, while not limiting the possibilities there are with Libadwaita and GTK.

If you want to use Adwaita in a project, but there are widgets missing, open an issue on GitHub.

Find more information about the project's motivation in this blog post.

Widgets

An overview of the widgets supported by Adwaita is available here.

Installation

Dependencies

Flatpak

It is recommended to develop apps inside of a Flatpak. That way, you don't have to install Swift or any of the dependencies on your system, and you always have access to the latest versions. Take a look at the template repository. This works on Linux only.

Directly on System

You can also run your apps directly on the system.

If you are using a Linux distribution, install libadwaita-devel or libadwaita (or something similar, based on the package manager) as well as gtk4-devel, gtk4 or similar.

On macOS, follow these steps:

  1. Install Homebrew.
  2. Install Libadwaita (and thereby GTK 4):
brew install libadwaita

Swift Package

  1. Open your Swift package in GNOME Builder, Xcode, or any other IDE.
  2. Open the Package.swift file.
  3. Into the Package initializer, under dependencies, paste:
.package(url: "https://github.com/AparokshaUI/Adwaita", from: "0.1.0")   

Usage

I recommend using the template repository as a starting point.

Basics

Advanced

Information

Thanks

Dependencies

Other Thanks