@@ -9,7 +9,7 @@ import UIKit
9
9
@available ( iOS 13 . 0 , tvOS 13 . 0 , macOS 10 . 15 . 0 , * )
10
10
extension View {
11
11
public func inject< SomeView> ( _ view: SomeView ) -> some View where SomeView: View {
12
- return overlay ( view. frame ( width: 0 , height: 0 ) )
12
+ overlay ( view. frame ( width: 0 , height: 0 ) )
13
13
}
14
14
}
15
15
@@ -22,15 +22,15 @@ extension View {
22
22
selector: @escaping ( IntrospectionUIView ) -> TargetView ? ,
23
23
customize: @escaping ( TargetView ) -> ( )
24
24
) -> some View {
25
- return inject ( UIKitIntrospectionView (
25
+ inject ( UIKitIntrospectionView (
26
26
selector: selector,
27
27
customize: customize
28
28
) )
29
29
}
30
30
31
31
/// Finds a `UINavigationController` from any view embedded in a `SwiftUI.NavigationView`.
32
32
public func introspectNavigationController( customize: @escaping ( UINavigationController ) -> ( ) ) -> some View {
33
- return inject ( UIKitIntrospectionViewController (
33
+ inject ( UIKitIntrospectionViewController (
34
34
selector: { introspectionViewController in
35
35
36
36
// Search in ancestors
@@ -47,7 +47,7 @@ extension View {
47
47
48
48
/// Finds a `UISplitViewController` from a `SwiftUI.NavigationView` with style `DoubleColumnNavigationViewStyle`.
49
49
public func introspectSplitViewController( customize: @escaping ( UISplitViewController ) -> ( ) ) -> some View {
50
- return inject ( UIKitIntrospectionViewController (
50
+ inject ( UIKitIntrospectionViewController (
51
51
selector: { introspectionViewController in
52
52
53
53
// Search in ancestors
@@ -64,15 +64,15 @@ extension View {
64
64
65
65
/// Finds the containing `UIViewController` of a SwiftUI view.
66
66
public func introspectViewController( customize: @escaping ( UIViewController ) -> ( ) ) -> some View {
67
- return inject ( UIKitIntrospectionViewController (
67
+ inject ( UIKitIntrospectionViewController (
68
68
selector: { $0. parent } ,
69
69
customize: customize
70
70
) )
71
71
}
72
72
73
73
/// Finds a `UITabBarController` from any SwiftUI view embedded in a `SwiftUI.TabView`
74
74
public func introspectTabBarController( customize: @escaping ( UITabBarController ) -> ( ) ) -> some View {
75
- return inject ( UIKitIntrospectionViewController (
75
+ inject ( UIKitIntrospectionViewController (
76
76
selector: { introspectionViewController in
77
77
78
78
// Search in ancestors
@@ -89,12 +89,12 @@ extension View {
89
89
90
90
/// Finds a `UITableView` from a `SwiftUI.List`, or `SwiftUI.List` child.
91
91
public func introspectTableView( customize: @escaping ( UITableView ) -> ( ) ) -> some View {
92
- return introspect ( selector: TargetViewSelector . ancestorOrSiblingContaining, customize: customize)
92
+ introspect ( selector: TargetViewSelector . ancestorOrSiblingContaining, customize: customize)
93
93
}
94
94
95
95
/// Finds a `UITableViewCell` from a `SwiftUI.List`, or `SwiftUI.List` child. You can attach this directly to the element inside the list.
96
96
public func introspectTableViewCell( customize: @escaping ( UITableViewCell ) -> ( ) ) -> some View {
97
- return introspect ( selector: TargetViewSelector . ancestorOrSiblingContaining, customize: customize)
97
+ introspect ( selector: TargetViewSelector . ancestorOrSiblingContaining, customize: customize)
98
98
}
99
99
100
100
/// Finds a `UIScrollView` from a `SwiftUI.ScrollView`, or `SwiftUI.ScrollView` child.
@@ -108,48 +108,48 @@ extension View {
108
108
109
109
/// Finds a `UITextField` from a `SwiftUI.TextField`
110
110
public func introspectTextField( customize: @escaping ( UITextField ) -> ( ) ) -> some View {
111
- return introspect ( selector: TargetViewSelector . siblingContainingOrAncestorOrAncestorChild, customize: customize)
111
+ introspect ( selector: TargetViewSelector . siblingContainingOrAncestorOrAncestorChild, customize: customize)
112
112
}
113
113
114
114
/// Finds a `UITextView` from a `SwiftUI.TextEditor`
115
115
public func introspectTextView( customize: @escaping ( UITextView ) -> ( ) ) -> some View {
116
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
116
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
117
117
}
118
118
119
119
/// Finds a `UISwitch` from a `SwiftUI.Toggle`
120
120
@available ( tvOS, unavailable)
121
121
public func introspectSwitch( customize: @escaping ( UISwitch ) -> ( ) ) -> some View {
122
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
122
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
123
123
}
124
124
125
125
/// Finds a `UISlider` from a `SwiftUI.Slider`
126
126
@available ( tvOS, unavailable)
127
127
public func introspectSlider( customize: @escaping ( UISlider ) -> ( ) ) -> some View {
128
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
128
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
129
129
}
130
130
131
131
/// Finds a `UIStepper` from a `SwiftUI.Stepper`
132
132
@available ( tvOS, unavailable)
133
133
public func introspectStepper( customize: @escaping ( UIStepper ) -> ( ) ) -> some View {
134
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
134
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
135
135
}
136
136
137
137
/// Finds a `UIDatePicker` from a `SwiftUI.DatePicker`
138
138
@available ( tvOS, unavailable)
139
139
public func introspectDatePicker( customize: @escaping ( UIDatePicker ) -> ( ) ) -> some View {
140
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
140
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
141
141
}
142
142
143
143
/// Finds a `UISegmentedControl` from a `SwiftUI.Picker` with style `SegmentedPickerStyle`
144
144
public func introspectSegmentedControl( customize: @escaping ( UISegmentedControl ) -> ( ) ) -> some View {
145
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
145
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
146
146
}
147
147
148
148
/// Finds a `UIColorWell` from a `SwiftUI.ColorPicker`
149
149
@available ( iOS 14 . 0 , * )
150
150
@available ( tvOS, unavailable)
151
151
public func introspectColorWell( customize: @escaping ( UIColorWell ) -> ( ) ) -> some View {
152
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
152
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
153
153
}
154
154
}
155
155
#endif
@@ -163,20 +163,20 @@ extension View {
163
163
selector: @escaping ( IntrospectionNSView ) -> TargetView ? ,
164
164
customize: @escaping ( TargetView ) -> ( )
165
165
) -> some View {
166
- return inject ( AppKitIntrospectionView (
166
+ inject ( AppKitIntrospectionView (
167
167
selector: selector,
168
168
customize: customize
169
169
) )
170
170
}
171
171
172
172
/// Finds a `NSTableView` from a `SwiftUI.List`, or `SwiftUI.List` child.
173
173
public func introspectTableView( customize: @escaping ( NSTableView ) -> ( ) ) -> some View {
174
- return introspect ( selector: TargetViewSelector . ancestorOrSiblingContaining, customize: customize)
174
+ introspect ( selector: TargetViewSelector . ancestorOrSiblingContaining, customize: customize)
175
175
}
176
176
177
177
/// Finds a `NSTableCellView` from a `SwiftUI.List`, or `SwiftUI.List` child. You can attach this directly to the element inside the list.
178
178
public func introspectTableViewCell( customize: @escaping ( NSTableCellView ) -> ( ) ) -> some View {
179
- return introspect ( selector: TargetViewSelector . ancestorOrSiblingContaining, customize: customize)
179
+ introspect ( selector: TargetViewSelector . ancestorOrSiblingContaining, customize: customize)
180
180
}
181
181
182
182
/// Finds a `NSScrollView` from a `SwiftUI.ScrollView`, or `SwiftUI.ScrollView` child.
@@ -190,48 +190,48 @@ extension View {
190
190
191
191
/// Finds a `NSTextField` from a `SwiftUI.TextField`
192
192
public func introspectTextField( customize: @escaping ( NSTextField ) -> ( ) ) -> some View {
193
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
193
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
194
194
}
195
195
196
196
/// Finds a `NSTextView` from a `SwiftUI.TextView`
197
197
public func introspectTextView( customize: @escaping ( NSTextView ) -> ( ) ) -> some View {
198
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
198
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
199
199
}
200
200
201
201
/// Finds a `NSSlider` from a `SwiftUI.Slider`
202
202
public func introspectSlider( customize: @escaping ( NSSlider ) -> ( ) ) -> some View {
203
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
203
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
204
204
}
205
205
206
206
/// Finds a `NSStepper` from a `SwiftUI.Stepper`
207
207
public func introspectStepper( customize: @escaping ( NSStepper ) -> ( ) ) -> some View {
208
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
208
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
209
209
}
210
210
211
211
/// Finds a `NSDatePicker` from a `SwiftUI.DatePicker`
212
212
public func introspectDatePicker( customize: @escaping ( NSDatePicker ) -> ( ) ) -> some View {
213
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
213
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
214
214
}
215
215
216
216
/// Finds a `NSSegmentedControl` from a `SwiftUI.Picker` with style `SegmentedPickerStyle`
217
217
public func introspectSegmentedControl( customize: @escaping ( NSSegmentedControl ) -> ( ) ) -> some View {
218
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
218
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
219
219
}
220
220
221
221
/// Finds a `NSTabView` from a `SwiftUI.TabView`
222
222
public func introspectTabView( customize: @escaping ( NSTabView ) -> ( ) ) -> some View {
223
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
223
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
224
224
}
225
225
226
226
/// Finds a `NSButton` from a `SwiftUI.Button`
227
227
public func introspectButton( customize: @escaping ( NSButton ) -> ( ) ) -> some View {
228
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
228
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
229
229
}
230
230
231
231
/// Finds a `NSColorWell` from a `SwiftUI.ColorPicker`
232
232
@available ( macOS 11 . 0 , * )
233
233
public func introspectColorWell( customize: @escaping ( NSColorWell ) -> ( ) ) -> some View {
234
- return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
234
+ introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
235
235
}
236
236
}
237
237
#endif
0 commit comments