So, we have a watchOS app in production featuring a list inside a navigation stack and a searchable modifier.
All worked well, but ever since the release of watchOS 10.2, the search bar has stopped working.
You can view, tap, and write a query, but the binding to the state variable does not work and it's impossible to read the user's query.
I've written a very simple demo View that showcases the issue. I tried it on a Series 7 Apple Watch running watchOS 10.2.
struct ContentView: View {
@State private var searchText = ""
@State private var showResult = false
var body: some View {
NavigationStack {
List {
Text("1")
Text("2")
Text("3")
if showResult {
Text(searchText)
}
}
}
.searchable(text: $searchText)
.onChange(of: searchText) { _, searchText in
showResult = true
}
}
}
By the way, breakpoints on either @State searchText
or inside the .onChange
modifier are never triggered.
I have three questions:
Apple finally fixed it in watchOS 10.4.