@@ -11,7 +11,8 @@ struct SearchFieldTests {
1111    #endif 
1212
1313    @available ( iOS 15 ,  tvOS 15 ,  * )  
14-     @Test   func  introspectInNavigationStack( )  async  throws  { 
14+     @Test ( . disabledOn_iOS26_exceptFor_iPad)  
15+     func  introspectInNavigationStack( )  async  throws  { 
1516        try   await  introspection ( of:  PlatformSearchField . self)  {  spy in 
1617            NavigationView  { 
1718                Text ( " Customized " ) 
@@ -24,8 +25,25 @@ struct SearchFieldTests {
2425        } 
2526    } 
2627
28+     @available ( iOS 26 ,  * )  
29+     @Test   func  introspectInNavigationStackInTabView( )  async  throws  { 
30+         try   await  introspection ( of:  PlatformSearchField . self)  {  spy in 
31+             TabView  { 
32+                 NavigationView  { 
33+                     Text ( " Customized " ) 
34+                         . searchable ( text:  . constant( " " ) ) 
35+                 } 
36+                 . navigationViewStyle ( . stack) 
37+             } 
38+             #if os(iOS) || os(tvOS) || os(visionOS) 
39+             . introspect( . searchField,  on:  . iOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . tvOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . visionOS( . v1,  . v2,  . v26) ,  customize:  spy) 
40+             #endif 
41+         } 
42+     } 
43+ 
2744    @available ( iOS 15 ,  tvOS 15 ,  * )  
28-     @Test   func  introspectInNavigationStackAsAncestor( )  async  throws  { 
45+     @Test ( . disabledOn_iOS26_exceptFor_iPad)  
46+     func  introspectInNavigationStackAsAncestor( )  async  throws  { 
2947        try   await  introspection ( of:  PlatformSearchField . self)  {  spy in 
3048            NavigationView  { 
3149                Text ( " Customized " ) 
@@ -38,17 +56,33 @@ struct SearchFieldTests {
3856        } 
3957    } 
4058
59+     @available ( iOS 26 ,  * )  
60+     @Test   func  introspectInNavigationStackInTabViewAsAncestor( )  async  throws  { 
61+         try   await  introspection ( of:  PlatformSearchField . self)  {  spy in 
62+             TabView  { 
63+                 NavigationView  { 
64+                     Text ( " Customized " ) 
65+                         . searchable ( text:  . constant( " " ) ) 
66+                         #if os(iOS) || os(tvOS) || os(visionOS) 
67+                         . introspect( . searchField,  on:  . iOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . tvOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . visionOS( . v1,  . v2,  . v26) ,  scope:  . ancestor,  customize:  spy) 
68+                         #endif 
69+                 } 
70+                 . navigationViewStyle ( . stack) 
71+             } 
72+         } 
73+     } 
74+ 
4175    @available ( iOS 15 ,  tvOS 15 ,  * )  
42-     @available ( visionOS ,  introduced :   1 ,  obsoleted :   26 )  
43-     @ Test   func  introspectInNavigationSplitView( )  async  throws  { 
76+     @Test ( . disabledOn_iOS26_exceptFor_iPad )  
77+     func  introspectInNavigationSplitView( )  async  throws  { 
4478        try   await  introspection ( of:  PlatformSearchField . self)  {  spy in 
4579            NavigationView  { 
4680                Text ( " Customized " ) 
4781                    . searchable ( text:  . constant( " " ) ) 
4882            } 
4983            . navigationViewStyle ( DoubleColumnNavigationViewStyle ( ) ) 
5084            #if os(iOS) || os(tvOS) || os(visionOS) 
51-             . introspect( . searchField,  on:  . iOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . tvOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . visionOS( . v1,  . v2) ,  customize:  spy) 
85+             . introspect( . searchField,  on:  . iOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . tvOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . visionOS( . v1,  . v2,   . v26 ) ,  customize:  spy) 
5286            #endif 
5387            #if os(iOS) 
5488            // NB: this is necessary for introspection to work, because on iPad the search field is in the sidebar, which is initially hidden.
@@ -59,8 +93,31 @@ struct SearchFieldTests {
5993        } 
6094    } 
6195
96+     @available ( iOS 26 ,  * )  
97+     @Test   func  introspectInNavigationSplitViewInTabView( )  async  throws  { 
98+         try   await  introspection ( of:  PlatformSearchField . self)  {  spy in 
99+             TabView  { 
100+                 NavigationView  { 
101+                     Text ( " Customized " ) 
102+                         . searchable ( text:  . constant( " " ) ) 
103+                 } 
104+                 . navigationViewStyle ( DoubleColumnNavigationViewStyle ( ) ) 
105+                 #if os(iOS) || os(tvOS) || os(visionOS) 
106+                 . introspect( . searchField,  on:  . iOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . tvOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . visionOS( . v1,  . v2,  . v26) ,  customize:  spy) 
107+                 #endif 
108+                 #if os(iOS) 
109+                 // NB: this is necessary for introspection to work, because on iPad the search field is in the sidebar, which is initially hidden.
110+                 . introspect( . navigationView( style:  . columns) ,  on:  . iOS( . v13,  . v14,  . v15,  . v16,  . v17,  . v18,  . v26) )  { 
111+                     $0. preferredDisplayMode =  . oneOverSecondary
112+                 } 
113+                 #endif 
114+             } 
115+         } 
116+     } 
117+ 
62118    @available ( iOS 15 ,  tvOS 15 ,  * )  
63-     @Test   func  introspectInNavigationSplitViewAsAncestor( )  async  throws  { 
119+     @Test ( . disabledOn_iOS26_exceptFor_iPad)  
120+     func  introspectInNavigationSplitViewAsAncestor( )  async  throws  { 
64121        try   await  introspection ( of:  PlatformSearchField . self)  {  spy in 
65122            NavigationView  { 
66123                Text ( " Customized " ) 
@@ -78,5 +135,40 @@ struct SearchFieldTests {
78135            #endif 
79136        } 
80137    } 
138+ 
139+     @available ( iOS 26 ,  * )  
140+     @Test   func  introspectInNavigationSplitViewInTabViewAsAncestor( )  async  throws  { 
141+         try   await  introspection ( of:  PlatformSearchField . self)  {  spy in 
142+             TabView  { 
143+                 NavigationView  { 
144+                     Text ( " Customized " ) 
145+                         . searchable ( text:  . constant( " " ) ) 
146+                         #if os(iOS) || os(tvOS) || os(visionOS) 
147+                         . introspect( . searchField,  on:  . iOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . tvOS( . v15,  . v16,  . v17,  . v18,  . v26) ,  . visionOS( . v1,  . v2,  . v26) ,  scope:  . ancestor,  customize:  spy) 
148+                         #endif 
149+                 } 
150+                 . navigationViewStyle ( DoubleColumnNavigationViewStyle ( ) ) 
151+                 #if os(iOS) 
152+                 // NB: this is necessary for introspection to work, because on iPad the search field is in the sidebar, which is initially hidden.
153+                 . introspect( . navigationView( style:  . columns) ,  on:  . iOS( . v13,  . v14,  . v15,  . v16,  . v17,  . v18,  . v26) )  { 
154+                     $0. preferredDisplayMode =  . oneOverSecondary
155+                 } 
156+                 #endif 
157+             } 
158+         } 
159+     } 
81160} 
82161#endif 
162+ 
163+ @MainActor  
164+ extension  Trait  where  Self ==  ConditionTrait  { 
165+     // TODO: rename to `disabled on iOS 26+ except for iPad` when Swift 6.2 becomes available (on Xcode 26)
166+     static  var  disabledOn_iOS26_exceptFor_iPad :  Self  { 
167+         let  disabled  =  if  #available( iOS 26 ,  * )  { 
168+             UIDevice . current. userInterfaceIdiom !=  . pad
169+         }  else  { 
170+             false 
171+         } 
172+         return  . disabled( if:  disabled) 
173+     } 
174+ } 
0 commit comments