Skip to content

Commit d620dac

Browse files
authored
Remove outdated availability conditions in Showcase (#485)
1 parent 7167c94 commit d620dac

File tree

7 files changed

+54
-62
lines changed

7 files changed

+54
-62
lines changed

Examples/Showcase/Showcase/AppView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ struct AppView: View {
77
#if os(iOS) || os(tvOS) || os(visionOS)
88
.introspect(
99
.window,
10-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
10+
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
1111
) { window in
1212
window.backgroundColor = .brown
1313
}
1414
#elseif os(macOS)
15-
.introspect(.window, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { window in
15+
.introspect(.window, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { window in
1616
window.backgroundColor = .lightGray
1717
}
1818
#endif
@@ -46,7 +46,7 @@ struct ContentView: View {
4646
.tag(5)
4747
}
4848
#if os(iOS) || os(tvOS)
49-
.introspect(.tabView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { tabBarController in
49+
.introspect(.tabView, on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26)) { tabBarController in
5050
if #available(iOS 26, macOS 26, tvOS 26, *) {
5151
tabBarController.tabBar.backgroundColor = .green
5252
} else {
@@ -58,7 +58,7 @@ struct ContentView: View {
5858
}
5959
}
6060
#elseif os(macOS)
61-
.introspect(.tabView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { splitView in
61+
.introspect(.tabView, on: .macOS(.v12, .v13, .v14)) { splitView in
6262
splitView.subviews.first?.layer?.backgroundColor = NSColor.green.cgColor
6363
}
6464
#endif

Examples/Showcase/Showcase/Controls.swift

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ struct ControlsShowcase: View {
1616
#if os(iOS) || os(tvOS) || os(visionOS)
1717
.introspect(
1818
.textField,
19-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
19+
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
2020
) { textField in
2121
textField.backgroundColor = .red
2222
}
2323
#elseif os(macOS)
24-
.introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { textField in
24+
.introspect(.textField, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { textField in
2525
textField.backgroundColor = .red
2626
}
2727
#endif
@@ -31,12 +31,12 @@ struct ControlsShowcase: View {
3131
#if os(iOS) || os(tvOS) || os(visionOS)
3232
.introspect(
3333
.textField,
34-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
34+
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
3535
) { textField in
3636
textField.backgroundColor = .green
3737
}
3838
#elseif os(macOS)
39-
.introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { textField in
39+
.introspect(.textField, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { textField in
4040
textField.backgroundColor = .green
4141
}
4242
#endif
@@ -49,12 +49,12 @@ struct ControlsShowcase: View {
4949
#if os(iOS)
5050
.introspect(
5151
.toggle,
52-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)
52+
on: .iOS(.v15, .v16, .v17, .v18, .v26)
5353
) { toggle in
5454
toggle.backgroundColor = .red
5555
}
5656
#elseif os(macOS)
57-
.introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { toggle in
57+
.introspect(.toggle, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { toggle in
5858
toggle.layer?.backgroundColor = NSColor.red.cgColor
5959
}
6060
#endif
@@ -63,12 +63,12 @@ struct ControlsShowcase: View {
6363
#if os(iOS)
6464
.introspect(
6565
.toggle,
66-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)
66+
on: .iOS(.v15, .v16, .v17, .v18, .v26)
6767
) { toggle in
6868
toggle.backgroundColor = .green
6969
}
7070
#elseif os(macOS)
71-
.introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { toggle in
71+
.introspect(.toggle, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { toggle in
7272
toggle.layer?.backgroundColor = NSColor.green.cgColor
7373
}
7474
#endif
@@ -77,22 +77,22 @@ struct ControlsShowcase: View {
7777
HStack {
7878
Slider(value: $sliderValue, in: 0...100)
7979
#if os(iOS)
80-
.introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { slider in
80+
.introspect(.slider, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { slider in
8181
slider.backgroundColor = .red
8282
}
8383
#elseif os(macOS)
84-
.introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { slider in
84+
.introspect(.slider, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { slider in
8585
slider.layer?.backgroundColor = NSColor.red.cgColor
8686
}
8787
#endif
8888

8989
Slider(value: $sliderValue, in: 0...100)
9090
#if os(iOS)
91-
.introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { slider in
91+
.introspect(.slider, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { slider in
9292
slider.backgroundColor = .green
9393
}
9494
#elseif os(macOS)
95-
.introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { slider in
95+
.introspect(.slider, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { slider in
9696
slider.layer?.backgroundColor = NSColor.green.cgColor
9797
}
9898
#endif
@@ -103,11 +103,11 @@ struct ControlsShowcase: View {
103103
Text("Stepper Red")
104104
}
105105
#if os(iOS)
106-
.introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { stepper in
106+
.introspect(.stepper, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { stepper in
107107
stepper.backgroundColor = .red
108108
}
109109
#elseif os(macOS)
110-
.introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { stepper in
110+
.introspect(.stepper, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { stepper in
111111
stepper.layer?.backgroundColor = NSColor.red.cgColor
112112
}
113113
#endif
@@ -116,11 +116,11 @@ struct ControlsShowcase: View {
116116
Text("Stepper Green")
117117
}
118118
#if os(iOS)
119-
.introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { stepper in
119+
.introspect(.stepper, on: .iOS(.v15, .v16, .v17, .v18, .v26)) { stepper in
120120
stepper.backgroundColor = .green
121121
}
122122
#elseif os(macOS)
123-
.introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { stepper in
123+
.introspect(.stepper, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { stepper in
124124
stepper.layer?.backgroundColor = NSColor.green.cgColor
125125
}
126126
#endif
@@ -132,11 +132,11 @@ struct ControlsShowcase: View {
132132
Text("DatePicker Red")
133133
}
134134
#if os(iOS) || os(visionOS)
135-
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { datePicker in
135+
.introspect(.datePicker, on: .iOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)) { datePicker in
136136
datePicker.backgroundColor = .red
137137
}
138138
#elseif os(macOS)
139-
.introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { datePicker in
139+
.introspect(.datePicker, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { datePicker in
140140
datePicker.layer?.backgroundColor = NSColor.red.cgColor
141141
}
142142
#endif
@@ -153,12 +153,12 @@ struct ControlsShowcase: View {
153153
#if os(iOS) || os(tvOS) || os(visionOS)
154154
.introspect(
155155
.picker(style: .segmented),
156-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
156+
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
157157
) { datePicker in
158158
datePicker.backgroundColor = .red
159159
}
160160
#elseif os(macOS)
161-
.introspect(.picker(style: .segmented), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { datePicker in
161+
.introspect(.picker(style: .segmented), on: .macOS(.v12, .v13, .v14, .v15, .v26)) { datePicker in
162162
datePicker.layer?.backgroundColor = NSColor.red.cgColor
163163
}
164164
#endif

Examples/Showcase/Showcase/List.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct ListShowcase: View {
4343
}
4444
}
4545
#if os(iOS) || os(tvOS) || os(visionOS)
46-
.introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { tableView in
46+
.introspect(.list, on: .iOS(.v15), .tvOS(.v15, .v16, .v17, .v18, .v26)) { tableView in
4747
tableView.backgroundView = UIView()
4848
tableView.backgroundColor = .cyan
4949
}
@@ -53,7 +53,7 @@ struct ListShowcase: View {
5353
}
5454
}
5555
#elseif os(macOS)
56-
.introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { tableView in
56+
.introspect(.list, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { tableView in
5757
DispatchQueue.main.async {
5858
receiverListFound = true
5959
}
@@ -71,7 +71,7 @@ struct ListShowcase: View {
7171
Text("Item 1")
7272
Text("Item 2")
7373
#if os(iOS) || os(tvOS) || os(visionOS)
74-
.introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), scope: .ancestor) { tableView in
74+
.introspect(.list, on: .iOS(.v15), .tvOS(.v15, .v16, .v17, .v18, .v26), scope: .ancestor) { tableView in
7575
tableView.backgroundView = UIView()
7676
tableView.backgroundColor = .cyan
7777
}
@@ -81,7 +81,7 @@ struct ListShowcase: View {
8181
}
8282
}
8383
#elseif os(macOS)
84-
.introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor) { tableView in
84+
.introspect(.list, on: .macOS(.v12, .v13, .v14, .v15, .v26), scope: .ancestor) { tableView in
8585
DispatchQueue.main.async {
8686
ancestorListFound = true
8787
}

Examples/Showcase/Showcase/Navigation.swift

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ struct NavigationShowcase: View {
55
var body: some View {
66
NavigationView {
77
Text("Content")
8-
.modifier {
9-
if #available(iOS 15, tvOS 15, macOS 12, *) {
10-
$0.searchable(text: .constant(""))
11-
} else {
12-
$0
13-
}
14-
}
8+
.searchable(text: .constant(""))
159
#if os(iOS) || os(visionOS)
1610
.navigationBarTitle(Text("Customized"), displayMode: .inline)
1711
#elseif os(macOS)
@@ -21,21 +15,21 @@ struct NavigationShowcase: View {
2115
#if os(iOS) || os(tvOS) || os(visionOS)
2216
.introspect(
2317
.navigationView(style: .stack),
24-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
18+
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
2519
) { navigationController in
2620
navigationController.navigationBar.backgroundColor = .cyan
2721
}
2822
.introspect(
2923
.navigationView(style: .columns),
30-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
24+
on: .iOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
3125
) { splitViewController in
3226
#if os(visionOS)
3327
splitViewController.preferredDisplayMode = .oneBesideSecondary
3428
#else
3529
splitViewController.preferredDisplayMode = .oneOverSecondary
3630
#endif
3731
}
38-
.introspect(.navigationView(style: .columns), on: .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)) { navigationController in
32+
.introspect(.navigationView(style: .columns), on: .tvOS(.v15, .v16, .v17, .v18, .v26)) { navigationController in
3933
navigationController.navigationBar.backgroundColor = .cyan
4034
}
4135
.introspect(

Examples/Showcase/Showcase/Presentation.swift

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct PresentationShowcase: View {
1515
#if os(iOS) || os(tvOS)
1616
.introspect(
1717
.sheet,
18-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26)
18+
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26)
1919
) { presentationController in
2020
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
2121
}
@@ -26,20 +26,18 @@ struct PresentationShowcase: View {
2626
#endif
2727
}
2828

29-
if #available(iOS 14, tvOS 14, *) {
30-
Button("Full Screen Cover", action: { isFullScreenPresented = true })
31-
.fullScreenCover(isPresented: $isFullScreenPresented) {
32-
Button("Dismiss", action: { isFullScreenPresented = false })
33-
#if os(iOS) || os(tvOS) || os(visionOS)
34-
.introspect(
35-
.fullScreenCover,
36-
on: .iOS(.v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
37-
) { presentationController in
38-
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
39-
}
40-
#endif
41-
}
42-
}
29+
Button("Full Screen Cover", action: { isFullScreenPresented = true })
30+
.fullScreenCover(isPresented: $isFullScreenPresented) {
31+
Button("Dismiss", action: { isFullScreenPresented = false })
32+
#if os(iOS) || os(tvOS) || os(visionOS)
33+
.introspect(
34+
.fullScreenCover,
35+
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
36+
) { presentationController in
37+
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
38+
}
39+
#endif
40+
}
4341

4442
#if os(iOS) || os(visionOS)
4543
Button("Popover", action: { isPopoverPresented = true })
@@ -48,7 +46,7 @@ struct PresentationShowcase: View {
4846
.padding()
4947
.introspect(
5048
.popover,
51-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
49+
on: .iOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
5250
) { presentationController in
5351
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
5452
}

Examples/Showcase/Showcase/ScrollView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ struct ScrollViewShowcase: View {
3131
#if os(iOS) || os(tvOS) || os(visionOS)
3232
.introspect(
3333
.scrollView,
34-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
34+
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26)
3535
) { _ in
3636
DispatchQueue.main.async {
3737
receiverScrollViewFound = true
3838
}
3939
}
4040
#elseif os(macOS)
41-
.introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26)) { scrollView in
41+
.introspect(.scrollView, on: .macOS(.v12, .v13, .v14, .v15, .v26)) { scrollView in
4242
DispatchQueue.main.async {
4343
receiverScrollViewFound = true
4444
}
@@ -55,15 +55,15 @@ struct ScrollViewShowcase: View {
5555
#if os(iOS) || os(tvOS) || os(visionOS)
5656
.introspect(
5757
.scrollView,
58-
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26),
58+
on: .iOS(.v15, .v16, .v17, .v18, .v26), .tvOS(.v15, .v16, .v17, .v18, .v26), .visionOS(.v1, .v2, .v26),
5959
scope: .ancestor
6060
) { _ in
6161
DispatchQueue.main.async {
6262
ancestorScrollViewFound = true
6363
}
6464
}
6565
#elseif os(macOS)
66-
.introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), scope: .ancestor) { scrollView in
66+
.introspect(.scrollView, on: .macOS(.v12, .v13, .v14, .v15, .v26), scope: .ancestor) { scrollView in
6767
DispatchQueue.main.async {
6868
ancestorScrollViewFound = true
6969
}

0 commit comments

Comments
 (0)