Skip to content

Instantly share code, notes, and snippets.

@ndurell
Created Apr 26, 2017
Embed
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