Swift script to generate Country enumerator with emoji and local language country name
Just download Country.swift
file to start using!
See for yourself:
let brazil = Country.br
print(brazil.englishName) // Brazil
print(brazil.nativeName) // Brasil
print(brazil.iPhoneLanguageName) // Brazil
print(brazil.flag) // ๐ง๐ท
print(brazil.phoneCode.first!) // +55
print(brazil.spokenLanguages.first!) // pt
And thanks to user Kametrixom on StackOverflow you can use it on a Picker View.
for country in Country.cases() {
print("\(country.flag) \(country.englishName) \(country.phoneCode.first!)")
}
//๐ฆ๐ฉ Andorra +376
//๐ฆ๐ช United Arab Emirates +971
//๐ฆ๐ซ Afghanistan +93
//๐ฆ๐ฌ Antigua and Barbuda +1268
//๐ฆ๐ฎ Anguilla +1264
//๐ฆ๐ฑ Albania +355
//๐ฆ๐ฒ Armenia +374
//๐ฆ๐ด Angola +244
//๐ฆ๐ถ Antarctica +672
//๐ฆ๐ท Argentina +54
//๐ฆ๐ธ American Samoa +1684
//๐ฆ๐น Austria +43
//๐ฆ๐บ Australia +61
//๐ฆ๐ผ Aruba +297
//๐ฆ๐ฝ ร
land +358
//๐ฆ๐ฟ Azerbaijan +994
//๐ง๐ฆ Bosnia and Herzegovina +387
//๐ง๐ง Barbados +1246
//๐ง๐ฉ Bangladesh +880
//๐ง๐ช Belgium +32
//๐ง๐ซ Burkina Faso +226
//๐ง๐ฌ Bulgaria +359
//๐ง๐ญ Bahrain +973
//๐ง๐ฎ Burundi +257
//๐ง๐ฏ Benin +229
//๐ง๐ฑ Saint Barthรฉlemy +590
//๐ง๐ฒ Bermuda +1441
//๐ง๐ณ Brunei +673
//๐ง๐ด Bolivia +591
//๐ง๐ถ Bonaire +5997
//๐ง๐ท Brazil +55
//๐ง๐ธ Bahamas +1242
//๐ง๐น Bhutan +975
//๐ง๐ป Bouvet Island +47
//๐ง๐ผ Botswana +267
//๐ง๐พ Belarus +375
//๐ง๐ฟ Belize +501
//๐จ๐ฆ Canada +1
//.......
I didn't want to use libs just to show country flags.