In my application I use a search that works well but I need advice. I do not know how to do that when I search for text without diacritics that the result also with diacriti
This is Martin R's solution, just easier to consume.
Copy this into a Swift file:
extension String {
func contains(insensitive other: String, range: Range? = nil, locale: Locale? = nil) -> Bool {
return self.range(of: other, options: [.diacriticInsensitive, .caseInsensitive], range: range, locale: locale) != nil
}
}
Use it like this:
if "Música".contains(insensitive: "music") {
print("hurray!")
}