When using the new .searchable()
modifier in SwiftUI on iOS 15 I have no way to customize the Search Bar appearance. Specifically, I wan't it to look good with the color I'm using for my Navigation Bar.
I tried altering the .appearance()
like this.
UISearchBar.appearance().backgroundColor = UIColor.white
UISearchBar.appearance().tintColor = UIColor.white
UISearchBar.appearance().barTintColor = UIColor.white
But only managed to get this.
Even though this kind of succeeded the spacing does not look good. I would rather tint it white.
ContentView
? This is because by adding thesearchable()
modifier, theTextField
is transparent – Thedathedric