Created
August 30, 2019 15:35
-
-
Save agiletalk/7d81df5d2a8787262be3438c2e2687ca to your computer and use it in GitHub Desktop.
This file contains 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
import Foundation | |
struct Repo: Decodable { | |
let name: String | |
let private: Bool | |
let language: String | |
} | |
let json = """ | |
[ | |
{ | |
"name": "SignUp", | |
"private": false, | |
"language": "Swift" | |
}, | |
{ | |
"name": "tomate", | |
"private": false, | |
"language": "Swift" | |
}, | |
{ | |
"name": "springmemo", | |
"private": false, | |
"language": "Python" | |
} | |
] | |
""".data(using: .utf8)! | |
let repos = try JSONDecoder().decode([Repo].self, from: json) | |
repos.forEach { print($0) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment