Created
September 17, 2017 23:44
-
-
Save Stoff81/dc9581ee1523698133dc420611c6b216 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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