File tree Expand file tree Collapse file tree
Sources/SwiftUIHidden-examples Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments