@@ -2,69 +2,69 @@ import SwiftUI
22import SwiftUIIntrospect
33
44struct AppView : View {
5- var body : some View {
6- ContentView ( )
7- #if os(iOS) || os(tvOS) || os(visionOS)
8- . introspect(
9- . window,
10- on: . iOS( . v15, . v16, . v17, . v18, . v26) , . tvOS( . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26)
11- ) { window in
12- window. backgroundColor = . brown
13- }
14- #elseif os(macOS)
15- . introspect( . window, on: . macOS( . v12, . v13, . v14, . v15, . v26) ) { window in
16- window. backgroundColor = . lightGray
17- }
18- #endif
19- }
5+ var body : some View {
6+ ContentView ( )
7+ #if os(iOS) || os(tvOS) || os(visionOS)
8+ . introspect(
9+ . window,
10+ on: . iOS( . v15, . v16, . v17, . v18, . v26) , . tvOS( . v15, . v16, . v17, . v18, . v26) , . visionOS( . v1, . v2, . v26)
11+ ) { window in
12+ window. backgroundColor = . brown
13+ }
14+ #elseif os(macOS)
15+ . introspect( . window, on: . macOS( . v12, . v13, . v14, . v15, . v26) ) { window in
16+ window. backgroundColor = . lightGray
17+ }
18+ #endif
19+ }
2020}
2121
2222struct ContentView : View {
23- @State var selection = 0
23+ @State var selection = 0
2424
25- var body : some View {
26- TabView ( selection: $selection) {
27- ListShowcase ( )
28- . tabItem { Label ( " List " , systemImage: " 1.circle " ) }
29- . tag ( 0 )
30- ScrollViewShowcase ( )
31- . tabItem { Label ( " ScrollView " , systemImage: " 2.circle " ) }
32- . tag ( 1 )
33- #if !os(macOS)
34- NavigationShowcase ( )
35- . tabItem { Label ( " Navigation " , systemImage: " 3.circle " ) }
36- . tag ( 2 )
37- PresentationShowcase ( )
38- . tabItem { Label ( " Presentation " , systemImage: " 4.circle " ) }
39- . tag ( 3 )
40- #endif
41- ControlsShowcase ( )
42- . tabItem { Label ( " Controls " , systemImage: " 5.circle " ) }
43- . tag ( 4 )
44- UIViewRepresentableShowcase ( )
45- . tabItem { Label ( " UIViewRepresentable " , systemImage: " 6.circle " ) }
46- . tag ( 5 )
47- }
48- #if os(iOS) || os(tvOS)
49- . introspect( . tabView, on: . iOS( . v15, . v16, . v17, . v18, . v26) , . tvOS( . v15, . v16, . v17, . v18, . v26) ) { tabBarController in
50- if #available( iOS 26 , macOS 26 , tvOS 26 , * ) {
51- tabBarController. tabBar. backgroundColor = . green
52- } else {
53- let appearance = UITabBarAppearance ( )
54- appearance. configureWithOpaqueBackground ( )
55- appearance. backgroundColor = . green
56- tabBarController. tabBar. standardAppearance = appearance
57- tabBarController. tabBar. scrollEdgeAppearance = appearance
58- }
59- }
60- #elseif os(macOS)
61- . introspect( . tabView, on: . macOS( . v12, . v13, . v14) ) { splitView in
62- splitView. subviews. first? . layer? . backgroundColor = NSColor . green. cgColor
63- }
64- #endif
65- }
25+ var body : some View {
26+ TabView ( selection: $selection) {
27+ ListShowcase ( )
28+ . tabItem { Label ( " List " , systemImage: " 1.circle " ) }
29+ . tag ( 0 )
30+ ScrollViewShowcase ( )
31+ . tabItem { Label ( " ScrollView " , systemImage: " 2.circle " ) }
32+ . tag ( 1 )
33+ #if !os(macOS)
34+ NavigationShowcase ( )
35+ . tabItem { Label ( " Navigation " , systemImage: " 3.circle " ) }
36+ . tag ( 2 )
37+ PresentationShowcase ( )
38+ . tabItem { Label ( " Presentation " , systemImage: " 4.circle " ) }
39+ . tag ( 3 )
40+ #endif
41+ ControlsShowcase ( )
42+ . tabItem { Label ( " Controls " , systemImage: " 5.circle " ) }
43+ . tag ( 4 )
44+ UIViewRepresentableShowcase ( )
45+ . tabItem { Label ( " UIViewRepresentable " , systemImage: " 6.circle " ) }
46+ . tag ( 5 )
47+ }
48+ #if os(iOS) || os(tvOS)
49+ . introspect( . tabView, on: . iOS( . v15, . v16, . v17, . v18, . v26) , . tvOS( . v15, . v16, . v17, . v18, . v26) ) { tabBarController in
50+ if #available( iOS 26 , macOS 26 , tvOS 26 , * ) {
51+ tabBarController. tabBar. backgroundColor = . green
52+ } else {
53+ let appearance = UITabBarAppearance ( )
54+ appearance. configureWithOpaqueBackground ( )
55+ appearance. backgroundColor = . green
56+ tabBarController. tabBar. standardAppearance = appearance
57+ tabBarController. tabBar. scrollEdgeAppearance = appearance
58+ }
59+ }
60+ #elseif os(macOS)
61+ . introspect( . tabView, on: . macOS( . v12, . v13, . v14) ) { splitView in
62+ splitView. subviews. first? . layer? . backgroundColor = NSColor . green. cgColor
63+ }
64+ #endif
65+ }
6666}
6767
6868#Preview {
69- AppView ( )
69+ AppView ( )
7070}
0 commit comments