Description
The filter/search function is lacking a lot. The current implementation filters only by the country name, and even then. It could be much better if users can also filter by the phoneCode. For example, if I want to lookup Germany I can either type "Germany" or "+49".
Another improvement that you can make is to run the comparison while reseting base diacritic characters. For example, Austria is written in German as "Österreich", or in some accents "Osterreich". Notice there is a difference in the first letter. With your current text matching, the if I try to search for Austria with the second accent I will get false:
// Current implementation
let text1 = "Österreich"
let text2 = "Osterreich"
let result = text1.localizedLowercase.contains(text2.localizedLowercase) // false
// Improved implementation
let text1 = "Österreich"
let text2 = "Osterreich"
let options: String.CompareOptions = [.diacriticInsensitive, .caseInsensitive, .widthInsensitive]
let first = text1.folding(options: options, locale: .current)
let second = text2.folding(options: options, locale: .current)
let result = first.contains(second) // true
Description
The filter/search function is lacking a lot. The current implementation filters only by the country name, and even then. It could be much better if users can also filter by the
phoneCode. For example, if I want to lookup Germany I can either type"Germany"or"+49".Another improvement that you can make is to run the comparison while reseting base diacritic characters. For example, Austria is written in German as "Österreich", or in some accents "Osterreich". Notice there is a difference in the first letter. With your current text matching, the if I try to search for Austria with the second accent I will get false: