I try to use the new .searchable feature. The following code works as expected:
import SwiftUI
struct ContentView: View {
@State private var searchText = ""
var body: some View {
NavigationView {
List {
ForEach(0..<100) { index in
Text("Row \(index)")
}
}
.searchable(text: $searchText)
.navigationTitle("Title")
// .navigationBarHidden(true)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
If you remove the comment, the searchbar is no longer available. Any idea why this happens and how to avoid this?