Skip to content

Instantly share code, notes, and snippets.

@vasilevkin
Last active October 30, 2019 12:13
Show Gist options
  • Save vasilevkin/28fcb85804bab26cfed4fa103724cd8b to your computer and use it in GitHub Desktop.
Save vasilevkin/28fcb85804bab26cfed4fa103724cd8b to your computer and use it in GitHub Desktop.
func loadArticles() throws -> [Article] {
let decoder = JSONDecoder()
return try files.map { file in
let data = try file.read()
let article = try decoder.decode(Article.self, from: data)
return article
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment