Skip to content

Instantly share code, notes, and snippets.

@giovani-pereira-ifood
Last active July 27, 2020 18:07
Show Gist options
  • Save giovani-pereira-ifood/169810f4f3f43aa42c034a156733eff0 to your computer and use it in GitHub Desktop.
Save giovani-pereira-ifood/169810f4f3f43aa42c034a156733eff0 to your computer and use it in GitHub Desktop.
struct User: Codable {
let name: String
let preferences: [Preference]
}
struct Account: Codable {
let uuid: String
let email: String?
let address: Address?
}
struct Address: Codable {
let street: String
let location: Location
}
struct Location: Codable {
let lat: Double
let lon: Double
}
struct Preference: Codable {
let type: PreferenceType
let color: ColorPreference
}
enum PreferenceType: Int, Codable {
case primary = 0
case secondary = 1
}
enum ColorPreference: String, Codable {
case red = "RED"
case yellow = "YELLOW"
case blue = "BLUE"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment