Skip to content

Instantly share code, notes, and snippets.

@StewartLynch
Last active July 18, 2021 04:49
Show Gist options
  • Save StewartLynch/4353f0b91ed9404fa3c1b2e49355c5cd to your computer and use it in GitHub Desktop.
Save StewartLynch/4353f0b91ed9404fa3c1b2e49355c5cd to your computer and use it in GitHub Desktop.
//
// Country.swift
// Country
//
// Created by Stewart Lynch on 2021-07-16.
//
import Foundation
struct Country: Identifiable {
var id: UUID {
UUID()
}
let name: String
let code: String
let flag: String
static func country(code: String) -> Country {
Self.countries.first { $0.code.lowercased() == code.lowercased()}!
}
static var countries:[Country] {
[
Country(name:"Anguilla", code:"AI", flag:"๐Ÿ‡ฆ๐Ÿ‡ฎ"),
Country(name:"Australia", code:"AU", flag:"๐Ÿ‡ฆ๐Ÿ‡บ"),
Country(name:"Austria", code:"AT", flag:"๐Ÿ‡ฆ๐Ÿ‡น"),
Country(name:"Belgium", code:"BE", flag:"๐Ÿ‡ง๐Ÿ‡ช"),
Country(name:"Brazil", code:"BR", flag:"๐Ÿ‡ง๐Ÿ‡ท"),
Country(name:"Bulgaria", code:"BG", flag:"๐Ÿ‡ง๐Ÿ‡ฌ"),
Country(name:"Canada", code:"CA", flag:"๐Ÿ‡จ๐Ÿ‡ฆ"),
Country(name:"China", code:"CN", flag:"๐Ÿ‡จ๐Ÿ‡ณ"),
Country(name:"Columbia", code:"CO", flag:"๐Ÿ‡จ๐Ÿ‡ด"),
Country(name:"Cuba", code:"CU", flag:"๐Ÿ‡จ๐Ÿ‡บ"),
Country(name:"Czech Republic", code:"CZ", flag:"๐Ÿ‡จ๐Ÿ‡ฟ"),
Country(name:"Egypt", code:"EG", flag:"๐Ÿ‡ช๐Ÿ‡ฌ"),
Country(name:"France", code:"FR", flag:"๐Ÿ‡ซ๐Ÿ‡ท"),
Country(name:"Germany", code:"DE", flag:"๐Ÿ‡ฉ๐Ÿ‡ช"),
Country(name:"Greece", code:"GR", flag:"๐Ÿ‡ฌ๐Ÿ‡ท"),
Country(name:"Hong Kong", code:"HK", flag:"๐Ÿ‡ญ๐Ÿ‡ฐ"),
Country(name:"Hungary", code:"HU", flag:"๐Ÿ‡ญ๐Ÿ‡บ"),
Country(name:"India", code:"IN", flag:"๐Ÿ‡ฎ๐Ÿ‡ณ"),
Country(name:"Indonesia", code:"ID", flag:"๐Ÿ‡ฎ๐Ÿ‡ฉ"),
Country(name:"Ireland", code:"IE", flag:"๐Ÿ‡ฎ๐Ÿ‡ช"),
Country(name:"Israel", code:"IL", flag:"๐Ÿ‡ฎ๐Ÿ‡ฑ"),
Country(name:"Italy", code:"IT", flag:"๐Ÿ‡ฎ๐Ÿ‡น"),
Country(name:"Japan", code:"JP", flag:"๐Ÿ‡ฏ๐Ÿ‡ต"),
Country(name:"Latvia", code:"LV", flag:"๐Ÿ‡ฑ๐Ÿ‡ป"),
Country(name:"Lithuania", code:"LT", flag:"๐Ÿ‡ฑ๐Ÿ‡น"),
Country(name:"Malaysia", code:"MY", flag:"๐Ÿ‡ฒ๐Ÿ‡พ"),
Country(name:"Mexico", code:"MX", flag:"๐Ÿ‡ฒ๐Ÿ‡ฝ"),
Country(name:"Morocco", code:"MA", flag:"๐Ÿ‡ฒ๐Ÿ‡ฆ"),
Country(name:"Netherlands", code:"NL", flag:"๐Ÿ‡ณ๐Ÿ‡ฑ"),
Country(name:"New Zealand", code:"NZ", flag:"๐Ÿ‡ณ๐Ÿ‡ฟ"),
Country(name:"Nigeria", code:"NG", flag:"๐Ÿ‡ณ๐Ÿ‡ฌ"),
Country(name:"Norway", code:"NO", flag:"๐Ÿ‡ณ๐Ÿ‡ด"),
Country(name:"Philippines", code:"PH", flag:"๐Ÿ‡ต๐Ÿ‡ญ"),
Country(name:"Poland", code:"PL", flag:"๐Ÿ‡ต๐Ÿ‡ฑ"),
Country(name:"Portugal", code:"PT", flag:"๐Ÿ‡ต๐Ÿ‡น"),
Country(name:"Romania", code:"RO", flag:"๐Ÿ‡ท๐Ÿ‡ด"),
Country(name:"Russia", code:"RU", flag:"๐Ÿ‡ท๐Ÿ‡บ"),
Country(name:"Saudi Arabia", code:"SA", flag:"๐Ÿ‡ธ๐Ÿ‡ฆ"),
Country(name:"Serbia", code:"RS", flag:"๐Ÿ‡ท๐Ÿ‡ธ"),
Country(name:"Singapore", code:"SG", flag:"๐Ÿ‡ธ๐Ÿ‡ฌ"),
Country(name:"Slovakia", code:"SK", flag:"๐Ÿ‡ธ๐Ÿ‡ฐ"),
Country(name:"Slovenia", code:"SI", flag:"๐Ÿ‡ธ๐Ÿ‡ฎ"),
Country(name:"South Africa", code:"ZA", flag:"๐Ÿ‡ฟ๐Ÿ‡ฆ"),
Country(name:"South Korea", code:"KR", flag:"๐Ÿ‡ฐ๐Ÿ‡ท"),
Country(name:"Sweden", code:"SE", flag:"๐Ÿ‡ธ๐Ÿ‡ช"),
Country(name:"Switzerland", code:"CH", flag:"๐Ÿ‡จ๐Ÿ‡ญ"),
Country(name:"Taiwan", code:"TW", flag:"๐Ÿ‡น๐Ÿ‡ผ"),
Country(name:"Thailand", code:"TH", flag:"๐Ÿ‡น๐Ÿ‡ญ"),
Country(name:"Turkey", code:"TR", flag:"๐Ÿ‡น๐Ÿ‡ท"),
Country(name:"Ukraine", code:"UA", flag:"๐Ÿ‡บ๐Ÿ‡ฆ"),
Country(name:"United Arab Emirates", code:"AE", flag:"๐Ÿ‡ฆ๐Ÿ‡ช"),
Country(name:"United Kingdom", code:"GB", flag:"๐Ÿ‡ฌ๐Ÿ‡ง"),
Country(name:"United States", code:"US", flag:"๐Ÿ‡บ๐Ÿ‡ธ"),
Country(name:"Venezuela", code:"VE", flag:"๐Ÿ‡ป๐Ÿ‡จ")
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment