I need to always show the search bar, but I want also to start the app with the large title. Instead what I get is a compacted version of it, like in the image:
If I scroll then the large title appear, but this looks ugly. And also I don’t want to use .navigationBarDrawer(displayMode: .automatic)
because it’s not intuitive for my specific case. Did anyone found a good workaround for this? I’ve found some for NavigationView
but that don’t work for my case with NavigationStack
.
Code example:
struct SearchView: View {
@State var searchText = ""
@ObservedObject private var viewModel: SearchViewModel
var body: some View {
NavigationStack(path: self.$viewModel.path) {
List {
Text("Simple View")
}
.navigationBarTitle("Search", displayMode: .large)
.searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always))
}
}
}