How can I hide cancel in title in searchbale bar in SwiftUI?

I have searchable properties in my project, everythings work, but it is looking bad when I search any items, it show "cancel" title inside of the search bar, how can I hide it?

  .searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always))

Could you show what you get as well as your code ?

In the meantime, may have a look at this; Cancel disappears when you are not editing or when you have tapped "Cancel"

h t t p s : / / w w w .appcoda.com/swiftui-search-bar/

you can use appearance .searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always)).onappear { UISearchBar.appearance().showsCancelButton = false }.onDisappear { UISearchBar.appearance().showsCancelButton = true }

How can I hide cancel in title in searchbale bar in SwiftUI?
 
 
Q