When using the new searchable(text:)
modifier introduced in SwiftUI 3, I am seeing that changing the accentColor using tint(_:)
or even the deprecated accentColor(_:)
modifier doesn’t work as expected as the “cancel” button remains blue. How would I approach this situation and change the foreground colour of it. Any help would be appreciated, Thanks in advance.
Change foreground colour of search bar’s “cancel” button.
You could use the UINavigationBar.appearance().tintColor = .white to set the "cancel" button color. And I am trying to change the text color of the searchable text. I tried UITextfield, UISearchBar but it's still not working.
Hello!
In onAppear
method of a view where you use searchable
- you can try UISearchBar.appearance().tintColor = .green