Compare commits
4 Commits
8811c923f4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 2344cce5d1 | |||
| 5e6a56b594 | |||
| 46232968f6 | |||
|
b8b7e692cc
|
61
README.md
61
README.md
@@ -1,62 +1,7 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="256" alt="Adwaita Template Icon" src="data/icons/io.github.AparokshaUI.AdwaitaTemplate.svg">
|
<h1 align="center">Bachelorproef | Fase 2</h1>
|
||||||
<h1 align="center">Adwaita Template</h1>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
_Adwaita Template_ is a template application for the [Adwaita for Swift package](https://adwaita-swift.aparoksha.dev/documentation/adwaita/).
|
Deze repository bevat een simpele, niet-functionele Calculator-UI, geschreven met [Adwaita for Swift](https://adwaita-swift.aparoksha.dev/documentation/adwaita/).
|
||||||
|
|
||||||
## Table of Contents
|
Deze UI werd ontwikkeld tijdens Fase 2 van de bachelorproef, om aan te tonen dat het mogelijk is om applicaties te schrijven die gebruik maken van Adwaita for Swift.
|
||||||
|
|
||||||
- [Installation](#Installation)
|
|
||||||
- [Usage](#Usage)
|
|
||||||
- [Thanks](#Thanks)
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
Install the [GNOME Builder](https://flathub.org/apps/org.gnome.Builder) IDE.
|
|
||||||
|
|
||||||
For designing an app icon, [App Icon Preview](https://flathub.org/apps/org.gnome.design.AppIconPreview) and [Inkscape](https://flathub.org/apps/org.inkscape.Inkscape) are recommended.
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> You do not have to install any dependencies of Adwaita for Swift, including Swift, on your system.
|
|
||||||
> The Adwaita template runs in a [Flatpak](https://flatpak.org/).
|
|
||||||
> The GNOME Builder will automatically download dependencies from [Flathub](https://flathub.org).
|
|
||||||
> You can also use [Visual Studio Code](https://code.visualstudio.com/) with a Docker [dev container](https://code.visualstudio.com/docs/devcontainers/containers) hosting the Swift toolchain and Adwaita libraries.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
1. Open this project in the GNOME Builder. It will start downloading the dependencies.
|
|
||||||
- GNOME Builder will start downloading dependencies when opened.
|
|
||||||
- For Visual Studio Code, enable the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), the [Swift extension](https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang) and the [CodeLLDB extension](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) and reopen the project window with the dev container. It may take a couple minutes to build.
|
|
||||||
2. Build and run the application.
|
|
||||||
- For GNOME Builder, use the "run" icon in the toolbar.
|
|
||||||
- For Visual Studio Code, select the "run and debug" tab in the leftmost sidebar, and then tap the run icon next to "Debug AdwaitaTemplate".
|
|
||||||
3. Change the app's name and other information about the application in the following files (and file names):
|
|
||||||
- `README.md`
|
|
||||||
- `Package.swift`
|
|
||||||
- `io.github.AparokshaUI.AdwaitaTemplate.json`
|
|
||||||
- `Sources/AdwaitaTemplate.swift`
|
|
||||||
- `data/io.github.AparokshaUI.AdwaitaTemplate.metainfo.xml`
|
|
||||||
- `data/io.github.AparokshaUI.AdwaitaTemplate.desktop`
|
|
||||||
- `data/icons/io.github.AparokshaUI.AdwaitaTemplate.Source.svg`
|
|
||||||
- `data/icons/io.github.AparokshaUI.AdwaitaTemplate.svg`
|
|
||||||
- `data/icons/io.github.AparokshaUI.AdwaitaTemplate-symbolic.svg`
|
|
||||||
4. Edit the code. Help is available [here](https://adwaita-swift.aparoksha.dev/), ask questions in the [forums](https://forums.aparoksha.dev/).
|
|
||||||
5. You can edit the app's icons using the previously installed tools according to [this](https://blogs.gnome.org/tbernard/2019/12/30/designing-an-icon-for-your-app/) tutorial.
|
|
||||||
6. In GNOME Builder, click on the dropdown next to the hammer and then on `Export`. Wait until the file manager appears, open the `.flatpak` file and install the app on your device!
|
|
||||||
7. If you want to publish your app, replace `debug` in the following build commands by `release`:
|
|
||||||
```
|
|
||||||
"swift build -c debug --static-swift-stdlib",
|
|
||||||
"install -Dm755 .build/debug/AdwaitaTemplate /app/bin/AdwaitaTemplate",
|
|
||||||
```
|
|
||||||
|
|
||||||
### Flatpak SPM Generator
|
|
||||||
|
|
||||||
If you want to e.g. publish your app on Flathub where no internet connection is allowed while running the build commands,
|
|
||||||
you can use [this tool](https://github.com/flatpak/flatpak-builder-tools/tree/master/spm) that lets you generate a Flatpak manifest JSON from a Swift package.
|
|
||||||
|
|
||||||
## Thanks
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
- [Adwaita for Swift](https://git.aparoksha.dev/aparoksha/adwaita-swift) licensed under the [MIT License](https://git.aparoksha.dev/aparoksha/adwaita-swift/src/branch/main/LICENSE.md)
|
|
||||||
- [Localized](https://git.aparoksha.dev/aparoksha/localized) licensed under the [MIT License](https://git.aparoksha.dev/aparoksha/localized/src/branch/main/LICENSE.md)
|
|
||||||
@@ -5,18 +5,94 @@ import Adwaita
|
|||||||
|
|
||||||
@main
|
@main
|
||||||
struct AdwaitaTemplate: App {
|
struct AdwaitaTemplate: App {
|
||||||
|
|
||||||
let app = AdwaitaApp(id: "io.github.AparokshaUI.AdwaitaTemplate")
|
let app = AdwaitaApp(id: "io.github.AparokshaUI.AdwaitaTemplate")
|
||||||
|
|
||||||
var scene: Scene {
|
var scene: Scene {
|
||||||
Window(id: "main") { window in
|
Window(id: "main") { window in
|
||||||
Text(Loc.helloWorld)
|
VStack(spacing: 8) {
|
||||||
.padding()
|
Text("Calculations here...")
|
||||||
.topToolbar {
|
.selectable(false)
|
||||||
ToolbarView(app: app, window: window)
|
VStack(spacing: 8) {
|
||||||
|
HStack(spacing: 8) {
|
||||||
|
Button("AC") {}
|
||||||
|
.keyboardShortcut("c", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("") {}
|
||||||
|
.hexpand()
|
||||||
|
Button("%") {}
|
||||||
|
.keyboardShortcut("percent", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("/") {}
|
||||||
|
.keyboardShortcut("slash", app: app)
|
||||||
|
.hexpand()
|
||||||
|
}
|
||||||
|
.vexpand()
|
||||||
|
HStack(spacing: 8) {
|
||||||
|
Button("7") {}
|
||||||
|
.keyboardShortcut("7", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("8") {}
|
||||||
|
.keyboardShortcut("8", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("9") {}
|
||||||
|
.keyboardShortcut("9", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("*") {}
|
||||||
|
.keyboardShortcut("asterisk", app: app)
|
||||||
|
.hexpand()
|
||||||
|
}
|
||||||
|
.vexpand()
|
||||||
|
HStack(spacing: 8) {
|
||||||
|
Button("4") {}
|
||||||
|
.keyboardShortcut("4", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("5") {}
|
||||||
|
.keyboardShortcut("5", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("6") {}
|
||||||
|
.keyboardShortcut("6", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("-") {}
|
||||||
|
.keyboardShortcut("minus", app: app)
|
||||||
|
.hexpand()
|
||||||
|
}
|
||||||
|
.vexpand()
|
||||||
|
HStack(spacing: 8) {
|
||||||
|
Button("1") {}
|
||||||
|
.keyboardShortcut("1", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("2") {}
|
||||||
|
.keyboardShortcut("2", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("3") {}
|
||||||
|
.keyboardShortcut("3", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("+") {}
|
||||||
|
.keyboardShortcut("plus", app: app)
|
||||||
|
.hexpand()
|
||||||
|
}
|
||||||
|
.vexpand()
|
||||||
|
HStack(spacing: 8) {
|
||||||
|
Button("0") {}
|
||||||
|
.keyboardShortcut("0", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("") {}
|
||||||
|
.hexpand()
|
||||||
|
Button(",") {}
|
||||||
|
.keyboardShortcut("comma", app: app)
|
||||||
|
.hexpand()
|
||||||
|
Button("=") {}
|
||||||
|
.keyboardShortcut("equal", app: app)
|
||||||
|
.hexpand()
|
||||||
|
}
|
||||||
|
.vexpand()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
.topToolbar {
|
||||||
|
ToolbarView(app: app, window: window)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.defaultSize(width: 450, height: 300)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"app-id": "io.github.AparokshaUI.AdwaitaTemplate",
|
"app-id": "io.github.AparokshaUI.AdwaitaTemplate",
|
||||||
"runtime": "org.gnome.Platform",
|
"runtime": "org.gnome.Platform",
|
||||||
"runtime-version": "47",
|
"runtime-version": "48",
|
||||||
"sdk": "org.gnome.Sdk",
|
"sdk": "org.gnome.Sdk",
|
||||||
"sdk-extensions": [
|
"sdk-extensions": [
|
||||||
"org.freedesktop.Sdk.Extension.swift6"
|
"org.freedesktop.Sdk.Extension.swift6"
|
||||||
|
|||||||
Reference in New Issue
Block a user