Skip to content

Commit 38aa445

Browse files
committed
Add examples
1 parent 525a5cd commit 38aa445

4 files changed

Lines changed: 89 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Wouter on 23/11/23.
6+
//
7+
8+
import SwiftUI
9+
import SwiftUIHidden
10+
11+
class AppActionsTestDelegate: NSObject, NSApplicationDelegate {
12+
func applicationDidFinishLaunching(_ notification: Notification) {
13+
AppActions.openSettings()
14+
AppActions.openWindow(id: "TestWindow")
15+
}
16+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Wouter on 23/11/23.
6+
//
7+
8+
import SwiftUI
9+
import SwiftUIHidden
10+
11+
struct FloatingWindowStyleTestScene: Scene {
12+
var body: some Scene {
13+
WindowGroup {
14+
Text("Hello")
15+
}
16+
.windowStyle(.hidden.floating)
17+
}
18+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Wouter on 23/11/23.
6+
//
7+
8+
import SwiftUI
9+
import SwiftUIHidden
10+
11+
struct OpenSettingsTestView: View {
12+
@Environment(\.hidden.openSettings) var openSettings
13+
14+
var body: some View {
15+
Button("Open Settings") {
16+
openSettings()
17+
}
18+
Form {
19+
List {
20+
Text("Hello")
21+
}
22+
.hidden.accessoryBar {
23+
HStack(spacing: .zero) {
24+
Button("Add", systemImage: "plus") {}
25+
Divider()
26+
Button("Remove", systemImage: "minus") {}
27+
}
28+
}
29+
}
30+
.formStyle(.grouped)
31+
}
32+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Wouter on 23/11/23.
6+
//
7+
8+
import SwiftUI
9+
import SwiftUIHidden
10+
11+
struct WithCurrentWindowTestView: View {
12+
@Environment(\.hidden.withCurrentWindow) var withCurrentWindow
13+
14+
var body: some View {
15+
Text("Hello")
16+
.task {
17+
withCurrentWindow { window in
18+
guard let window else { return }
19+
print("Hello from \(window.title)")
20+
}
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)