Skip to content

Instantly share code, notes, and snippets.

@Stoff81
Created September 17, 2017 23:44
Show Gist options
  • Save Stoff81/dc9581ee1523698133dc420611c6b216 to your computer and use it in GitHub Desktop.
Save Stoff81/dc9581ee1523698133dc420611c6b216 to your computer and use it in GitHub Desktop.
let jsonDecoder = JSONDecoder()
do {
let results = try jsonDecoder.decode(Drinks.self, from:drinks.data(using: .utf8)!)
for result in results.drinks {
print(result.description)
if let beer = result as? Beer {
print(beer.alcohol_content)
}
}
} catch {
print("caught: \(error)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment