Instructions for reading a file from the bundle
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
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