forked from AparokshaUI/adwaita-swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NavigationViewDemo.swift
65 lines (54 loc) · 1.4 KB
/
NavigationViewDemo.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// NavigationViewDemo.swift
// Adwaita
//
// Created by david-swift on 17.02.24.
//
// swiftlint:disable missing_docs
import Adwaita
struct NavigationViewDemo: View {
var app: GTUIApp
var view: Body {
VStack {
Button("View Demo") {
app.showWindow("navigation")
}
.suggested()
.pill()
.frame(maxWidth: 100)
.padding()
}
}
struct WindowContent: View {
@State private var stack = NavigationStack<Int>()
let spacing = 10
var view: Body {
NavigationView($stack, "Initial View") { component in
VStack {
Button("Add Next View") {
stack.push(component + 1)
}
Button("Pop View") {
stack.pop()
}
}
.spacing(spacing)
.padding()
.topToolbar {
HeaderBar.empty()
}
} initialView: {
VStack {
Button("Add First View") {
stack.push(1)
}
.padding()
}
.topToolbar {
HeaderBar.empty()
}
}
}
}
}
// swiftlint:enable missing_docs