File tree Expand file tree Collapse file tree 2 files changed +20
-25
lines changed Expand file tree Collapse file tree 2 files changed +20
-25
lines changed Original file line number Diff line number Diff line change @@ -131,14 +131,20 @@ extension View {
131
131
/// Customize is called with a `UICollectionView` wrapper, and the horizontal `UIScrollView`.
132
132
@available ( iOS 14 , tvOS 14 , * )
133
133
public func introspectPagedTabView( customize: @escaping ( UICollectionView , UIScrollView ) -> ( ) ) -> some View {
134
- return introspect ( selector: TargetViewSelector . ancestorOrSiblingContaining, customize: { ( collectionView: UICollectionView ) in
135
- for subview in collectionView. subviews {
136
- if NSStringFromClass ( type ( of: subview) ) . contains ( " EmbeddedScrollView " ) , let scrollView = subview as? UIScrollView {
137
- customize ( collectionView, scrollView)
138
- break
134
+ if #available( iOS 16 , * ) {
135
+ return introspect ( selector: TargetViewSelector . ancestorOrSiblingContaining, customize: { ( collectionView: UICollectionView ) in
136
+ customize ( collectionView, collectionView)
137
+ } )
138
+ } else {
139
+ return introspect ( selector: TargetViewSelector . ancestorOrSiblingContaining, customize: { ( collectionView: UICollectionView ) in
140
+ for subview in collectionView. subviews {
141
+ if NSStringFromClass ( type ( of: subview) ) . contains ( " EmbeddedScrollView " ) , let scrollView = subview as? UIScrollView {
142
+ customize ( collectionView, scrollView)
143
+ break
144
+ }
139
145
}
140
- }
141
- } )
146
+ } )
147
+ }
142
148
}
143
149
144
150
/// Finds a `UITextField` from a `SwiftUI.TextField`
Original file line number Diff line number Diff line change @@ -124,24 +124,13 @@ private struct PageTabViewStyleTestView: View {
124
124
let spy : ( UICollectionView , UIScrollView ) -> Void
125
125
126
126
var body : some View {
127
- if #available( iOS 16 , tvOS 16 , * ) {
128
- TabView {
129
- Text ( " Item 1 " )
130
- . tag ( 0 )
131
- }
132
- . tabViewStyle ( PageTabViewStyle ( ) )
133
- . introspectCollectionView { collectionView in
134
- spy ( collectionView, collectionView)
135
- }
136
- } else {
137
- TabView {
138
- Text ( " Item 1 " )
139
- . tag ( 0 )
140
- }
141
- . tabViewStyle ( PageTabViewStyle ( ) )
142
- . introspectPagedTabView { collectionView, scrollView in
143
- spy ( collectionView, scrollView)
144
- }
127
+ TabView {
128
+ Text ( " Item 1 " )
129
+ . tag ( 0 )
130
+ }
131
+ . tabViewStyle ( PageTabViewStyle ( ) )
132
+ . introspectPagedTabView { collectionView, scrollView in
133
+ spy ( collectionView, scrollView)
145
134
}
146
135
}
147
136
}
You can’t perform that action at this time.
0 commit comments