Skip to content

Instantly share code, notes, and snippets.

Created Apr 26, 2017
What would you like to do?
Instructions for reading a file from the bundle
let path : URL = Bundle.main.path(forResource: "scifi-novels", ofType: "json").flatMap {
URL.init(fileURLWithPath: $0)
let data = try! Data(contentsOf: path)
let json = try! JSONSerialization.jsonObject(with: data) as? [String: Any]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment