Skip to content

Commit 9afddab

Browse files
authored
Resolve malformed macOS version @available directives causing issues on Big Sur (#49)
1 parent d831f8a commit 9afddab

File tree

6 files changed

+32
-32
lines changed

6 files changed

+32
-32
lines changed

Introspect/AppKitIntrospectionView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import SwiftUI
33
import AppKit
44

55
/// Introspection NSView that is inserted alongside the target view.
6-
@available(macOS 15.0, *)
6+
@available(macOS 10.15.0, *)
77
public class IntrospectionNSView: NSView {
88

99
required init() {
@@ -23,7 +23,7 @@ public class IntrospectionNSView: NSView {
2323

2424
/// Introspection View that is injected into the UIKit hierarchy alongside the target view.
2525
/// After `updateNSView` is called, it calls `selector` to find the target view, then `customize` when the target view is found.
26-
@available(macOS 15.0, *)
26+
@available(macOS 10.15.0, *)
2727
public struct AppKitIntrospectionView<TargetViewType: NSView>: NSViewRepresentable {
2828

2929
/// Method that introspects the view hierarchy to find the target view.

Introspect/UIKitIntrospectionView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class IntrospectionUIView: UIView {
2020

2121
/// Introspection View that is injected into the UIKit hierarchy alongside the target view.
2222
/// After `updateUIView` is called, it calls `selector` to find the target view, then `customize` when the target view is found.
23-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
23+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
2424
public struct UIKitIntrospectionView<TargetViewType: UIView>: UIViewRepresentable {
2525

2626
/// Method that introspects the view hierarchy to find the target view.

Introspect/UIKitIntrospectionViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import SwiftUI
33
import UIKit
44

55
/// Introspection UIViewController that is inserted alongside the target view controller.
6-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
6+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
77
public class IntrospectionUIViewController: UIViewController {
88
required init() {
99
super.init(nibName: nil, bundle: nil)
@@ -17,7 +17,7 @@ public class IntrospectionUIViewController: UIViewController {
1717
}
1818

1919
/// This is the same logic as IntrospectionView but for view controllers. Please see details above.
20-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
20+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
2121
public struct UIKitIntrospectionViewController<TargetViewControllerType: UIViewController>: UIViewControllerRepresentable {
2222

2323
let selector: (IntrospectionUIViewController) -> TargetViewControllerType?

Introspect/ViewExtensions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import AppKit
66
import UIKit
77
#endif
88

9-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
9+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
1010
extension View {
1111
public func inject<SomeView>(_ view: SomeView) -> some View where SomeView: View {
1212
return overlay(view.frame(width: 0, height: 0))
1313
}
1414
}
1515

1616
#if canImport(UIKit)
17-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
17+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
1818
extension View {
1919

2020
/// Finds a `TargetView` from a `SwiftUI.View`
@@ -121,7 +121,7 @@ extension View {
121121
#endif
122122

123123
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
124-
@available(macOS 15.0, *)
124+
@available(macOS 10.15.0, *)
125125
extension View {
126126

127127
/// Finds a `TargetView` from a `SwiftUI.View`

IntrospectTests/AppKitTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import XCTest
44
import SwiftUI
55
@testable import Introspect
66

7-
@available(macOS 15.0, *)
7+
@available(macOS 10.15.0, *)
88
enum TestUtils {
99
static func present<ViewType: View>(view: ViewType) {
1010

@@ -19,7 +19,7 @@ enum TestUtils {
1919
}
2020
}
2121

22-
@available(macOS 15.0, *)
22+
@available(macOS 10.15.0, *)
2323
private struct ListTestView: View {
2424

2525
let spy1: () -> Void
@@ -39,7 +39,7 @@ private struct ListTestView: View {
3939
}
4040
}
4141

42-
@available(macOS 15.0, *)
42+
@available(macOS 10.15.0, *)
4343
private struct ScrollTestView: View {
4444

4545
let spy1: () -> Void
@@ -63,7 +63,7 @@ private struct ScrollTestView: View {
6363
}
6464
}
6565

66-
@available(macOS 15.0, *)
66+
@available(macOS 10.15.0, *)
6767
private struct TextFieldTestView: View {
6868
let spy: () -> Void
6969
@State private var textFieldValue = ""
@@ -75,7 +75,7 @@ private struct TextFieldTestView: View {
7575
}
7676
}
7777

78-
@available(macOS 15.0, *)
78+
@available(macOS 10.15.0, *)
7979
private struct SliderTestView: View {
8080
let spy: () -> Void
8181
@State private var sliderValue = 0.0
@@ -87,7 +87,7 @@ private struct SliderTestView: View {
8787
}
8888
}
8989

90-
@available(macOS 15.0, *)
90+
@available(macOS 10.15.0, *)
9191
private struct StepperTestView: View {
9292
let spy: () -> Void
9393
var body: some View {
@@ -100,7 +100,7 @@ private struct StepperTestView: View {
100100
}
101101
}
102102

103-
@available(macOS 15.0, *)
103+
@available(macOS 10.15.0, *)
104104
private struct DatePickerTestView: View {
105105
let spy: () -> Void
106106
@State private var datePickerValue = Date()
@@ -114,7 +114,7 @@ private struct DatePickerTestView: View {
114114
}
115115
}
116116

117-
@available(macOS 15.0, *)
117+
@available(macOS 10.15.0, *)
118118
private struct SegmentedControlTestView: View {
119119
@State private var pickerValue = 0
120120
let spy: () -> Void
@@ -131,7 +131,7 @@ private struct SegmentedControlTestView: View {
131131
}
132132
}
133133

134-
@available(macOS 15.0, *)
134+
@available(macOS 10.15.0, *)
135135
class AppKitTests: XCTestCase {
136136

137137
func testList() {

IntrospectTests/UIKitTests.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import SwiftUI
44

55
@testable import Introspect
66

7-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
7+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
88
enum TestUtils {
99
static func present<ViewType: View>(view: ViewType) {
1010

@@ -28,7 +28,7 @@ enum TestUtils {
2828
}
2929
}
3030

31-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
31+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
3232
private struct NavigationTestView: View {
3333
let spy: () -> Void
3434
var body: some View {
@@ -43,7 +43,7 @@ private struct NavigationTestView: View {
4343
}
4444
}
4545

46-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
46+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
4747
private struct ViewControllerTestView: View {
4848
let spy: () -> Void
4949
var body: some View {
@@ -58,7 +58,7 @@ private struct ViewControllerTestView: View {
5858
}
5959
}
6060

61-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
61+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
6262
private struct NavigationRootTestView: View {
6363
let spy: () -> Void
6464
var body: some View {
@@ -73,7 +73,7 @@ private struct NavigationRootTestView: View {
7373
}
7474
}
7575

76-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
76+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
7777
private struct TabTestView: View {
7878
@State private var selection = 0
7979
let spy: () -> Void
@@ -88,7 +88,7 @@ private struct TabTestView: View {
8888
}
8989
}
9090

91-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
91+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
9292
private struct TabRootTestView: View {
9393
@State private var selection = 0
9494
let spy: () -> Void
@@ -103,7 +103,7 @@ private struct TabRootTestView: View {
103103
}
104104
}
105105

106-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
106+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
107107
private struct ListTestView: View {
108108

109109
let spy1: () -> Void
@@ -123,7 +123,7 @@ private struct ListTestView: View {
123123
}
124124
}
125125

126-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
126+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
127127
private struct ScrollTestView: View {
128128

129129
let spy1: () -> Void
@@ -147,7 +147,7 @@ private struct ScrollTestView: View {
147147
}
148148
}
149149

150-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
150+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
151151
private struct TextFieldTestView: View {
152152
let spy: () -> Void
153153
@State private var textFieldValue = ""
@@ -159,7 +159,7 @@ private struct TextFieldTestView: View {
159159
}
160160
}
161161

162-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
162+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
163163
@available(tvOS, unavailable)
164164
private struct ToggleTestView: View {
165165
let spy: () -> Void
@@ -172,7 +172,7 @@ private struct ToggleTestView: View {
172172
}
173173
}
174174

175-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
175+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
176176
@available(tvOS, unavailable)
177177
private struct SliderTestView: View {
178178
let spy: () -> Void
@@ -185,7 +185,7 @@ private struct SliderTestView: View {
185185
}
186186
}
187187

188-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
188+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
189189
@available(tvOS, unavailable)
190190
private struct StepperTestView: View {
191191
let spy: () -> Void
@@ -199,7 +199,7 @@ private struct StepperTestView: View {
199199
}
200200
}
201201

202-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
202+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
203203
@available(tvOS, unavailable)
204204
private struct DatePickerTestView: View {
205205
let spy: () -> Void
@@ -214,7 +214,7 @@ private struct DatePickerTestView: View {
214214
}
215215
}
216216

217-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
217+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
218218
private struct SegmentedControlTestView: View {
219219
@State private var pickerValue = 0
220220
let spy: () -> Void
@@ -231,7 +231,7 @@ private struct SegmentedControlTestView: View {
231231
}
232232
}
233233

234-
@available(iOS 13.0, tvOS 13.0, macOS 15.0, *)
234+
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
235235
class UIKitTests: XCTestCase {
236236
func testNavigation() {
237237

0 commit comments

Comments
 (0)