@@ -18,10 +18,10 @@ For instance, when introspecting a `ScrollView`...
1818
1919``` swift
2020ScrollView {
21- Text (" Item 1" )
21+ Text (" Item 1" )
2222}
2323.introspect (.scrollView , on : .iOS (.v13 , .v14 , .v15 , .v16 , .v17 , .v18 , .v26 )) { scrollView in
24- // do something with UIScrollView
24+ // do something with UIScrollView
2525}
2626```
2727
@@ -37,10 +37,10 @@ By default, the `.introspect` modifier acts directly on its _receiver_. This mea
3737
3838``` swift
3939ScrollView {
40- Text (" Item 1" )
41- .introspect (.scrollView , on : .iOS (.v13 , .v14 , .v15 , .v16 , .v17 , .v18 , .v26 ), scope : .ancestor ) { scrollView in
42- // do something with UIScrollView
43- }
40+ Text (" Item 1" )
41+ .introspect (.scrollView , on : .iOS (.v13 , .v14 , .v15 , .v16 , .v17 , .v18 , .v26 ), scope : .ancestor ) { scrollView in
42+ // do something with UIScrollView
43+ }
4444}
4545```
4646
@@ -61,14 +61,14 @@ Install
6161
6262``` swift
6363let package = Package (
64- dependencies : [
65- .package (url : " https://github.com/siteline/swiftui-introspect" , from : " 1.0.0" ),
66- ],
67- targets : [
68- .target (name : < #Target Name#> , dependencies : [
69- .product (name : " SwiftUIIntrospect" , package : " swiftui-introspect" ),
70- ]),
71- ]
64+ dependencies : [
65+ .package (url : " https://github.com/siteline/swiftui-introspect" , from : " 1.0.0" ),
66+ ],
67+ targets : [
68+ .target (name : < #Target Name#> , dependencies : [
69+ .product (name : " SwiftUIIntrospect" , package : " swiftui-introspect" ),
70+ ]),
71+ ]
7272)
7373```
7474
@@ -151,48 +151,48 @@ Examples
151151
152152``` swift
153153List {
154- Text (" Item" )
154+ Text (" Item" )
155155}
156156.introspect (.list , on : .iOS (.v13 , .v14 , .v15 )) { tableView in
157- tableView.backgroundView = UIView ()
158- tableView.backgroundColor = .cyan
157+ tableView.backgroundView = UIView ()
158+ tableView.backgroundColor = .cyan
159159}
160160.introspect (.list , on : .iOS (.v16 , .v17 , .v18 , .v26 )) { collectionView in
161- collectionView.backgroundView = UIView ()
162- collectionView.subviews .dropFirst (1 ).first ? .backgroundColor = .cyan
161+ collectionView.backgroundView = UIView ()
162+ collectionView.subviews .dropFirst (1 ).first ? .backgroundColor = .cyan
163163}
164164```
165165
166166### ScrollView
167167
168168``` swift
169169ScrollView {
170- Text (" Item" )
170+ Text (" Item" )
171171}
172172.introspect (.scrollView , on : .iOS (.v13 , .v14 , .v15 , .v16 , .v17 , .v18 , .v26 )) { scrollView in
173- scrollView.backgroundColor = .red
173+ scrollView.backgroundColor = .red
174174}
175175```
176176
177177### NavigationView
178178
179179``` swift
180180NavigationView {
181- Text (" Item" )
181+ Text (" Item" )
182182}
183183.navigationViewStyle (.stack )
184184.introspect (.navigationView (style : .stack ), on : .iOS (.v13 , .v14 , .v15 , .v16 , .v17 , .v18 , .v26 )) { navigationController in
185- navigationController.navigationBar .backgroundColor = .cyan
185+ navigationController.navigationBar .backgroundColor = .cyan
186186}
187187```
188188
189189### TextField
190190
191191``` swift
192192TextField (" Text Field" , text : < #Binding < String > #> )
193- .introspect (.textField , on : .iOS (.v13 , .v14 , .v15 , .v16 , .v17 , .v18 , .v26 )) { textField in
194- textField.backgroundColor = .red
195- }
193+ .introspect (.textField , on : .iOS (.v13 , .v14 , .v15 , .v16 , .v17 , .v18 , .v26 )) { textField in
194+ textField.backgroundColor = .red
195+ }
196196```
197197
198198Advanced usage
@@ -213,44 +213,44 @@ import SwiftUI
213213public struct TextFieldType : IntrospectableViewType {}
214214
215215extension IntrospectableViewType where Self == TextFieldType {
216- public static var textField: Self { .init () }
216+ public static var textField: Self { .init () }
217217}
218218
219219#if canImport (UIKit )
220220extension iOSViewVersion<TextFieldType, UITextField> {
221- public static let v13 = Self (for : .v13 )
222- public static let v14 = Self (for : .v14 )
223- public static let v15 = Self (for : .v15 )
224- public static let v16 = Self (for : .v16 )
225- public static let v17 = Self (for : .v17 )
226- public static let v18 = Self (for : .v18 )
227- public static let v26 = Self (for : .v26 )
221+ public static let v13 = Self (for : .v13 )
222+ public static let v14 = Self (for : .v14 )
223+ public static let v15 = Self (for : .v15 )
224+ public static let v16 = Self (for : .v16 )
225+ public static let v17 = Self (for : .v17 )
226+ public static let v18 = Self (for : .v18 )
227+ public static let v26 = Self (for : .v26 )
228228}
229229
230230extension tvOSViewVersion<TextFieldType, UITextField> {
231- public static let v13 = Self (for : .v13 )
232- public static let v14 = Self (for : .v14 )
233- public static let v15 = Self (for : .v15 )
234- public static let v16 = Self (for : .v16 )
235- public static let v17 = Self (for : .v17 )
236- public static let v18 = Self (for : .v18 )
237- public static let v26 = Self (for : .v26 )
231+ public static let v13 = Self (for : .v13 )
232+ public static let v14 = Self (for : .v14 )
233+ public static let v15 = Self (for : .v15 )
234+ public static let v16 = Self (for : .v16 )
235+ public static let v17 = Self (for : .v17 )
236+ public static let v18 = Self (for : .v18 )
237+ public static let v26 = Self (for : .v26 )
238238}
239239
240240extension visionOSViewVersion<TextFieldType, UITextField> {
241- public static let v1 = Self (for : .v1 )
242- public static let v2 = Self (for : .v2 )
243- public static let v26 = Self (for : .v26 )
241+ public static let v1 = Self (for : .v1 )
242+ public static let v2 = Self (for : .v2 )
243+ public static let v26 = Self (for : .v26 )
244244}
245245#elseif canImport (AppKit )
246246extension macOSViewVersion<TextFieldType, NSTextField> {
247- public static let v10_15 = Self (for : .v10_15 )
248- public static let v11 = Self (for : .v11 )
249- public static let v12 = Self (for : .v12 )
250- public static let v13 = Self (for : .v13 )
251- public static let v14 = Self (for : .v14 )
252- public static let v15 = Self (for : .v15 )
253- public static let v26 = Self (for : .v26 )
247+ public static let v10_15 = Self (for : .v10_15 )
248+ public static let v11 = Self (for : .v11 )
249+ public static let v12 = Self (for : .v12 )
250+ public static let v13 = Self (for : .v13 )
251+ public static let v14 = Self (for : .v14 )
252+ public static let v15 = Self (for : .v15 )
253+ public static let v26 = Self (for : .v26 )
254254}
255255#endif
256256```
@@ -266,14 +266,14 @@ import SwiftUI
266266@_spi (Advanced) import SwiftUIIntrospect
267267
268268struct ContentView : View {
269- var body: some View {
270- ScrollView {
271- // ...
272- }
273- .introspect (.scrollView , on : .iOS (.v13 ... )) { scrollView in
274- // ...
275- }
276- }
269+ var body: some View {
270+ ScrollView {
271+ // ...
272+ }
273+ .introspect (.scrollView , on : .iOS (.v13 ... )) { scrollView in
274+ // ...
275+ }
276+ }
277277}
278278```
279279
@@ -288,16 +288,16 @@ import SwiftUI
288288@_spi (Advanced) import SwiftUIIntrospect
289289
290290struct ContentView : View {
291- @Weak var scrollView: UIScrollView?
292-
293- var body: some View {
294- ScrollView {
295- // ...
296- }
297- .introspect (.scrollView , on : .iOS (.v13 , .v14 , .v15 , .v16 , .v17 , .v18 , .v26 )) { scrollView in
298- self .scrollView = scrollView
299- }
300- }
291+ @Weak var scrollView: UIScrollView?
292+
293+ var body: some View {
294+ ScrollView {
295+ // ...
296+ }
297+ .introspect (.scrollView , on : .iOS (.v13 , .v14 , .v15 , .v16 , .v17 , .v18 , .v26 )) { scrollView in
298+ self .scrollView = scrollView
299+ }
300+ }
301301}
302302```
303303
0 commit comments