How can I change the title of the cancel button of a search bar?

Viewed 55

I am trying to learn SwiftUI. I am making a Contacts app and I want to customize .searchable() filter's "cancel" button text. I want to change that text and want to write different thing. How can I do that. If I want to do same thing in the Swift5 this was very easy thing to do but when it comes to SwiftUI, things can be different.

I want to change title of "cancel" button.

1

.searchable(text: $searchableText, prompt: "Look for a contact")
        .onChange(of: searchableText) { searchableText in
            contactVM.filteredContact = contactVM.contact.filter({ contact in
                contact.ad.lowercased().contains(searchableText.lowercased())
            })
        }

How can I customize that?

0 Answers
Related