Skip to content

Commit 75cb3eb

Browse files
committed
WIP
1 parent 978a39a commit 75cb3eb

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

Sources/ViewTypes/SearchField.swift

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,35 @@
1313
/// .searchable(text: $searchTerm)
1414
/// }
1515
/// .navigationViewStyle(.stack)
16-
/// .introspect(.searchField, on: .iOS(.v15, .v16, .v17, .v18, .v26)) {
16+
/// .introspect(.searchField, on: .iOS(.v15, .v16, .v17, .v18)) {
17+
/// print(type(of: $0)) // UISearchBar
18+
/// }
19+
/// }
20+
/// }
21+
/// ```
22+
///
23+
/// From iOS 26 onward, search bar is only backed by UIKit when `.searchable` is used within a
24+
/// `NavigationView` or `NavigationStack` contained inside a `TabView`.
25+
///
26+
/// If `.searchable` is used outside of these containers, it is backed by SwiftUI's own implementation,
27+
/// and there is no UIKit view to introspect.
28+
///
29+
/// ```swift
30+
/// struct ContentView: View {
31+
/// @State var searchTerm = ""
32+
///
33+
/// var body: some View {
34+
/// TabView {
35+
/// NavigationView {
36+
/// Text("Root")
37+
/// .searchable(text: $searchTerm)
38+
/// }
39+
/// .navigationViewStyle(.stack)
40+
/// .tabItem {
41+
/// Label("Home", systemImage: "house")
42+
/// }
43+
/// }
44+
/// .introspect(.searchField, on: .iOS(.v26)) {
1745
/// print(type(of: $0)) // UISearchBar
1846
/// }
1947
/// }

0 commit comments

Comments
 (0)