Skip to content

Commit 9304322

Browse files
authored
iOS 17 / tvOS 17 / macOS 14 support (#243)
1 parent 67e2a59 commit 9304322

File tree

87 files changed

+424
-277
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+424
-277
lines changed

Examples/Showcase/Showcase/ContentView.swift

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ struct ContentView: View {
2525
.tag(4)
2626
}
2727
#if os(iOS) || os(tvOS)
28-
.introspect(.tabView, on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { tabBarController in
28+
.introspect(.tabView, on: .iOS(.v13, .v14, .v15, .v16, .v17), .tvOS(.v13, .v14, .v15, .v16, .v17)) { tabBarController in
2929
tabBarController.tabBar.layer.backgroundColor = UIColor.green.cgColor
3030
}
3131
#elseif os(macOS)
32-
.introspect(.tabView, on: .macOS(.v10_15, .v11, .v12, .v13)) { splitView in
32+
.introspect(.tabView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { splitView in
3333
splitView.subviews.first?.layer?.backgroundColor = NSColor.green.cgColor
3434
}
3535
#endif
@@ -62,16 +62,16 @@ struct ListShowcase: View {
6262
Text("Item 2")
6363
}
6464
#if os(iOS) || os(tvOS)
65-
.introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16)) { tableView in
65+
.introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17)) { tableView in
6666
tableView.backgroundView = UIView()
6767
tableView.backgroundColor = .cyan
6868
}
69-
.introspect(.list, on: .iOS(.v16)) { collectionView in
69+
.introspect(.list, on: .iOS(.v16, .v17)) { collectionView in
7070
collectionView.backgroundView = UIView()
7171
collectionView.subviews.dropFirst(1).first?.backgroundColor = .cyan
7272
}
7373
#elseif os(macOS)
74-
.introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13)) { tableView in
74+
.introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { tableView in
7575
tableView.backgroundColor = .cyan
7676
}
7777
#endif
@@ -87,16 +87,16 @@ struct ListShowcase: View {
8787
Text("Item 1")
8888
Text("Item 2")
8989
#if os(iOS) || os(tvOS)
90-
.introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16), scope: .ancestor) { tableView in
90+
.introspect(.list, on: .iOS(.v13, .v14, .v15), .tvOS(.v13, .v14, .v15, .v16, .v17), scope: .ancestor) { tableView in
9191
tableView.backgroundView = UIView()
9292
tableView.backgroundColor = .cyan
9393
}
94-
.introspect(.list, on: .iOS(.v16), scope: .ancestor) { collectionView in
94+
.introspect(.list, on: .iOS(.v16, .v17), scope: .ancestor) { collectionView in
9595
collectionView.backgroundView = UIView()
9696
collectionView.subviews.dropFirst(1).first?.backgroundColor = .cyan
9797
}
9898
#elseif os(macOS)
99-
.introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13), scope: .ancestor) { tableView in
99+
.introspect(.list, on: .macOS(.v10_15, .v11, .v12, .v13, .v14), scope: .ancestor) { tableView in
100100
tableView.backgroundColor = .cyan
101101
}
102102
#endif
@@ -127,11 +127,11 @@ struct ScrollViewShowcase: View {
127127
.font(.system(.subheadline, design: .monospaced))
128128
}
129129
#if os(iOS) || os(tvOS)
130-
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { scrollView in
130+
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17), .tvOS(.v13, .v14, .v15, .v16, .v17)) { scrollView in
131131
scrollView.layer.backgroundColor = UIColor.cyan.cgColor
132132
}
133133
#elseif os(macOS)
134-
.introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13)) { scrollView in
134+
.introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { scrollView in
135135
scrollView.drawsBackground = true
136136
scrollView.backgroundColor = .cyan
137137
}
@@ -145,11 +145,11 @@ struct ScrollViewShowcase: View {
145145
.padding(.horizontal, 12)
146146
.font(.system(.subheadline, design: .monospaced))
147147
#if os(iOS) || os(tvOS)
148-
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16), scope: .ancestor) { scrollView in
148+
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17), .tvOS(.v13, .v14, .v15, .v16, .v17), scope: .ancestor) { scrollView in
149149
scrollView.layer.backgroundColor = UIColor.cyan.cgColor
150150
}
151151
#elseif os(macOS)
152-
.introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13), scope: .ancestor) { scrollView in
152+
.introspect(.scrollView, on: .macOS(.v10_15, .v11, .v12, .v13, .v14), scope: .ancestor) { scrollView in
153153
scrollView.drawsBackground = true
154154
scrollView.backgroundColor = .cyan
155155
}
@@ -177,16 +177,16 @@ struct NavigationShowcase: View {
177177
#endif
178178
}
179179
#if os(iOS) || os(tvOS)
180-
.introspect(.navigationView(style: .stack), on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { navigationController in
180+
.introspect(.navigationView(style: .stack), on: .iOS(.v13, .v14, .v15, .v16, .v17), .tvOS(.v13, .v14, .v15, .v16, .v17)) { navigationController in
181181
navigationController.navigationBar.backgroundColor = .cyan
182182
}
183-
.introspect(.navigationView(style: .columns), on: .iOS(.v13, .v14, .v15, .v16)) { splitViewController in
183+
.introspect(.navigationView(style: .columns), on: .iOS(.v13, .v14, .v15, .v16, .v17)) { splitViewController in
184184
splitViewController.preferredDisplayMode = .oneOverSecondary
185185
}
186-
.introspect(.navigationView(style: .columns), on: .tvOS(.v13, .v14, .v15, .v16)) { navigationController in
186+
.introspect(.navigationView(style: .columns), on: .tvOS(.v13, .v14, .v15, .v16, .v17)) { navigationController in
187187
navigationController.navigationBar.backgroundColor = .cyan
188188
}
189-
.introspect(.searchField, on: .iOS(.v15, .v16), .tvOS(.v15, .v16)) { searchBar in
189+
.introspect(.searchField, on: .iOS(.v15, .v16, .v17), .tvOS(.v15, .v16, .v17)) { searchBar in
190190
searchBar.backgroundColor = .red
191191
#if os(iOS)
192192
searchBar.searchTextField.backgroundColor = .purple
@@ -209,7 +209,7 @@ struct ViewControllerShowcase: View {
209209
}
210210
}
211211
.navigationViewStyle(.stack)
212-
.introspect(.view, on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { viewController in
212+
.introspect(.view, on: .iOS(.v13, .v14, .v15, .v16, .v17), .tvOS(.v13, .v14, .v15, .v16, .v17)) { viewController in
213213
viewController.children.first?.view.backgroundColor = .cyan
214214
}
215215
}
@@ -229,23 +229,23 @@ struct SimpleElementsShowcase: View {
229229
HStack {
230230
TextField("Text Field Red", text: $textFieldValue)
231231
#if os(iOS) || os(tvOS)
232-
.introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { textField in
232+
.introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16, .v17), .tvOS(.v13, .v14, .v15, .v16, .v17)) { textField in
233233
textField.backgroundColor = .red
234234
}
235235
#elseif os(macOS)
236-
.introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13)) { textField in
236+
.introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { textField in
237237
textField.backgroundColor = .red
238238
}
239239
#endif
240240

241241
TextField("Text Field Green", text: $textFieldValue)
242242
.cornerRadius(8)
243243
#if os(iOS) || os(tvOS)
244-
.introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { textField in
244+
.introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16, .v17), .tvOS(.v13, .v14, .v15, .v16, .v17)) { textField in
245245
textField.backgroundColor = .green
246246
}
247247
#elseif os(macOS)
248-
.introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13)) { textField in
248+
.introspect(.textField, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { textField in
249249
textField.backgroundColor = .green
250250
}
251251
#endif
@@ -254,22 +254,22 @@ struct SimpleElementsShowcase: View {
254254
HStack {
255255
Toggle("Toggle Red", isOn: $toggleValue)
256256
#if os(iOS)
257-
.introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16)) { toggle in
257+
.introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16, .v17)) { toggle in
258258
toggle.backgroundColor = .red
259259
}
260260
#elseif os(macOS)
261-
.introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13)) { toggle in
261+
.introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { toggle in
262262
toggle.layer?.backgroundColor = NSColor.red.cgColor
263263
}
264264
#endif
265265

266266
Toggle("Toggle Green", isOn: $toggleValue)
267267
#if os(iOS)
268-
.introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16)) { toggle in
268+
.introspect(.toggle, on: .iOS(.v13, .v14, .v15, .v16, .v17)) { toggle in
269269
toggle.backgroundColor = .green
270270
}
271271
#elseif os(macOS)
272-
.introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13)) { toggle in
272+
.introspect(.toggle, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { toggle in
273273
toggle.layer?.backgroundColor = NSColor.green.cgColor
274274
}
275275
#endif
@@ -279,22 +279,22 @@ struct SimpleElementsShowcase: View {
279279
HStack {
280280
Slider(value: $sliderValue, in: 0...100)
281281
#if os(iOS)
282-
.introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16)) { slider in
282+
.introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17)) { slider in
283283
slider.backgroundColor = .red
284284
}
285285
#elseif os(macOS)
286-
.introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13)) { slider in
286+
.introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { slider in
287287
slider.layer?.backgroundColor = NSColor.red.cgColor
288288
}
289289
#endif
290290

291291
Slider(value: $sliderValue, in: 0...100)
292292
#if os(iOS)
293-
.introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16)) { slider in
293+
.introspect(.slider, on: .iOS(.v13, .v14, .v15, .v16, .v17)) { slider in
294294
slider.backgroundColor = .green
295295
}
296296
#elseif os(macOS)
297-
.introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13)) { slider in
297+
.introspect(.slider, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { slider in
298298
slider.layer?.backgroundColor = NSColor.green.cgColor
299299
}
300300
#endif
@@ -305,11 +305,11 @@ struct SimpleElementsShowcase: View {
305305
Text("Stepper Red")
306306
}
307307
#if os(iOS)
308-
.introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16)) { stepper in
308+
.introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17)) { stepper in
309309
stepper.backgroundColor = .red
310310
}
311311
#elseif os(macOS)
312-
.introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13)) { stepper in
312+
.introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { stepper in
313313
stepper.layer?.backgroundColor = NSColor.red.cgColor
314314
}
315315
#endif
@@ -318,11 +318,11 @@ struct SimpleElementsShowcase: View {
318318
Text("Stepper Green")
319319
}
320320
#if os(iOS)
321-
.introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16)) { stepper in
321+
.introspect(.stepper, on: .iOS(.v13, .v14, .v15, .v16, .v17)) { stepper in
322322
stepper.backgroundColor = .green
323323
}
324324
#elseif os(macOS)
325-
.introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13)) { stepper in
325+
.introspect(.stepper, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { stepper in
326326
stepper.layer?.backgroundColor = NSColor.green.cgColor
327327
}
328328
#endif
@@ -333,11 +333,11 @@ struct SimpleElementsShowcase: View {
333333
Text("DatePicker Red")
334334
}
335335
#if os(iOS)
336-
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16)) { datePicker in
336+
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17)) { datePicker in
337337
datePicker.backgroundColor = .red
338338
}
339339
#elseif os(macOS)
340-
.introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13)) { datePicker in
340+
.introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { datePicker in
341341
datePicker.layer?.backgroundColor = NSColor.red.cgColor
342342
}
343343
#endif
@@ -352,11 +352,11 @@ struct SimpleElementsShowcase: View {
352352
}
353353
.pickerStyle(SegmentedPickerStyle())
354354
#if os(iOS) || os(tvOS)
355-
.introspect(.picker(style: .segmented), on: .iOS(.v13, .v14, .v15, .v16), .tvOS(.v13, .v14, .v15, .v16)) { datePicker in
355+
.introspect(.picker(style: .segmented), on: .iOS(.v13, .v14, .v15, .v16, .v17), .tvOS(.v13, .v14, .v15, .v16, .v17)) { datePicker in
356356
datePicker.backgroundColor = .red
357357
}
358358
#elseif os(macOS)
359-
.introspect(.picker(style: .segmented), on: .macOS(.v10_15, .v11, .v12, .v13)) { datePicker in
359+
.introspect(.picker(style: .segmented), on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) { datePicker in
360360
datePicker.layer?.backgroundColor = NSColor.red.cgColor
361361
}
362362
#endif

Sources/PlatformVersion.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ extension iOSVersion {
5252
}
5353
return false
5454
}
55+
56+
public static let v17 = iOSVersion {
57+
if #available(iOS 18, *) {
58+
return false
59+
}
60+
if #available(iOS 17, *) {
61+
return true
62+
}
63+
return false
64+
}
5565
}
5666

5767
public struct tvOSVersion: PlatformVersion {
@@ -102,6 +112,16 @@ extension tvOSVersion {
102112
}
103113
return false
104114
}
115+
116+
public static let v17 = tvOSVersion {
117+
if #available(tvOS 18, *) {
118+
return false
119+
}
120+
if #available(tvOS 17, *) {
121+
return true
122+
}
123+
return false
124+
}
105125
}
106126

107127
public struct macOSVersion: PlatformVersion {
@@ -162,4 +182,14 @@ extension macOSVersion {
162182
}
163183
return false
164184
}
185+
186+
public static let v14 = macOSVersion {
187+
if #available(macOS 15, *) {
188+
return false
189+
}
190+
if #available(macOS 14, *) {
191+
return true
192+
}
193+
return false
194+
}
165195
}

Sources/ViewTypes/Button.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ extension macOSViewVersion<ButtonType, NSButton> {
1515
public static let v11 = Self(for: .v11)
1616
public static let v12 = Self(for: .v12)
1717
public static let v13 = Self(for: .v13)
18+
public static let v14 = Self(for: .v14)
1819
}
1920
#endif
2021
#endif

Sources/ViewTypes/ColorPicker.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ extension iOSViewVersion<ColorPickerType, UIColorWell> {
1717
public static let v14 = Self(for: .v14)
1818
public static let v15 = Self(for: .v15)
1919
public static let v16 = Self(for: .v16)
20+
public static let v17 = Self(for: .v17)
2021
}
2122
#elseif canImport(AppKit)
2223
@available(macOS 11, *)
@@ -26,6 +27,7 @@ extension macOSViewVersion<ColorPickerType, NSColorWell> {
2627
public static let v11 = Self(for: .v11)
2728
public static let v12 = Self(for: .v12)
2829
public static let v13 = Self(for: .v13)
30+
public static let v14 = Self(for: .v14)
2931
}
3032
#endif
3133
#endif

Sources/ViewTypes/DatePicker.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ extension iOSViewVersion<DatePickerType, UIDatePicker> {
1515
public static let v14 = Self(for: .v14)
1616
public static let v15 = Self(for: .v15)
1717
public static let v16 = Self(for: .v16)
18+
public static let v17 = Self(for: .v17)
1819
}
1920
#elseif canImport(AppKit)
2021
extension macOSViewVersion<DatePickerType, NSDatePicker> {
2122
public static let v10_15 = Self(for: .v10_15)
2223
public static let v11 = Self(for: .v11)
2324
public static let v12 = Self(for: .v12)
2425
public static let v13 = Self(for: .v13)
26+
public static let v14 = Self(for: .v14)
2527
}
2628
#endif
2729
#endif

Sources/ViewTypes/DatePickerWithCompactStyle.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extension iOSViewVersion<DatePickerWithCompactStyleType, UIDatePicker> {
2020
public static let v14 = Self(for: .v14)
2121
public static let v15 = Self(for: .v15)
2222
public static let v16 = Self(for: .v16)
23+
public static let v17 = Self(for: .v17)
2324
}
2425
#elseif canImport(AppKit) && !targetEnvironment(macCatalyst)
2526
extension macOSViewVersion<DatePickerWithCompactStyleType, NSDatePicker> {
@@ -29,6 +30,7 @@ extension macOSViewVersion<DatePickerWithCompactStyleType, NSDatePicker> {
2930
public static let v11 = Self(for: .v11)
3031
public static let v12 = Self(for: .v12)
3132
public static let v13 = Self(for: .v13)
33+
public static let v14 = Self(for: .v14)
3234
}
3335
#endif
3436
#endif

Sources/ViewTypes/DatePickerWithFieldStyle.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ extension macOSViewVersion<DatePickerWithFieldStyleType, NSDatePicker> {
1919
public static let v11 = Self(for: .v11)
2020
public static let v12 = Self(for: .v12)
2121
public static let v13 = Self(for: .v13)
22+
public static let v14 = Self(for: .v14)
2223
}
2324
#endif
2425
#endif

Sources/ViewTypes/DatePickerWithGraphicalStyleType.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ extension iOSViewVersion<DatePickerWithGraphicalStyleType, UIDatePicker> {
2020
public static let v14 = Self(for: .v14)
2121
public static let v15 = Self(for: .v15)
2222
public static let v16 = Self(for: .v16)
23+
public static let v17 = Self(for: .v17)
2324
}
2425
#elseif canImport(AppKit) && !targetEnvironment(macCatalyst)
2526
extension macOSViewVersion<DatePickerWithGraphicalStyleType, NSDatePicker> {
2627
public static let v10_15 = Self(for: .v10_15)
2728
public static let v11 = Self(for: .v11)
2829
public static let v12 = Self(for: .v12)
2930
public static let v13 = Self(for: .v13)
31+
public static let v14 = Self(for: .v14)
3032
}
3133
#endif
3234
#endif

Sources/ViewTypes/DatePickerWithStepperFieldStyle.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ extension macOSViewVersion<DatePickerWithStepperFieldStyleType, NSDatePicker> {
1919
public static let v11 = Self(for: .v11)
2020
public static let v12 = Self(for: .v12)
2121
public static let v13 = Self(for: .v13)
22+
public static let v14 = Self(for: .v14)
2223
}
2324
#endif
2425
#endif

Sources/ViewTypes/DatePickerWithWheelStyle.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ extension iOSViewVersion<DatePickerWithWheelStyleType, UIDatePicker> {
1919
public static let v14 = Self(for: .v14)
2020
public static let v15 = Self(for: .v15)
2121
public static let v16 = Self(for: .v16)
22+
public static let v17 = Self(for: .v17)
2223
}
2324
#endif
2425
#endif

0 commit comments

Comments
 (0)