Skip to content

Instantly share code, notes, and snippets.

@Stoff81
Created September 17, 2017 23:39
Show Gist options
  • Save Stoff81/059f5c5b323a7663c3335b7fd2884042 to your computer and use it in GitHub Desktop.
Save Stoff81/059f5c5b323a7663c3335b7fd2884042 to your computer and use it in GitHub Desktop.
class Beer: Drink {
var alcohol_content: String
private enum CodingKeys: String, CodingKey {
case alcohol_content
}
required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.alcohol_content = try container.decode(String.self, forKey: .alcohol_content)
try super.init(from: decoder)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment