I am testing out the SwiftUI's feature .searchable(). But seems that the search bar would always has a space above it. Since the searchable is embedded in the naviagation bar, I understand the space as where the Navigation bar items go. But is there a way to remove that space and make the searchbar looking like that in Instagram? I have tried changing the navbar style to inline,as the code below, but there is still some space above it. Is there any logic behind the search bar's position?
NavigationView{
SearchView(searchText: $searchText)
.navigationBarTitleDisplayMode(.inline)
}
.searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always), suggestions: {
ForEach(searchResults, id: \.self){result in
Text(result).searchCompletion(result)
}
})