Skip to content

Instantly share code, notes, and snippets.

@randyzhao
Created May 13, 2018 23:06
Show Gist options
  • Save randyzhao/3acfbb8191faeeaa5450a519f978a124 to your computer and use it in GitHub Desktop.
Save randyzhao/3acfbb8191faeeaa5450a519f978a124 to your computer and use it in GitHub Desktop.
struct Country: Codable {
let countryName: String
let countryCode: String
private enum CodingKeys: String, CodingKey {
case countryName = "name"
case countryCode = "code"
}
}
enum UserType: Int, Codable {
case normal = 1
case admin = 2
}
struct User: Codable {
let username: String
let type: UserType
let country: Country
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment