Skip to content

Instantly share code, notes, and snippets.

@juliantejera
Created April 8, 2019 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliantejera/cbbc13a2de650d94c3a3313d08a235de to your computer and use it in GitHub Desktop.
Save juliantejera/cbbc13a2de650d94c3a3313d08a235de to your computer and use it in GitHub Desktop.
struct Alien: Decodable {
private enum CodingKeys: String, CodingKey {
case humans
}
let humans: [Human]
init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
humans = try container.decodeArrayWithOptionalElements([Human].self, forKey: .humans)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment