Last active
February 28, 2016 23:20
-
-
Save robertmryan/2e2418e9bb9a3cb37181 to your computer and use it in GitHub Desktop.
More complete example
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
var text: String! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let url = NSBundle.mainBundle().URLForResource("test", withExtension: "json")! | |
var files = [String : NSFileWrapper]() | |
var error: NSError? | |
files["file.json"] = NSFileWrapper(URL: url, options: nil, error: &error) | |
if let file = files["file.json"], | |
contents = file.regularFileContents, | |
stringContents = NSString(data: contents, encoding: NSUTF8StringEncoding) { | |
text = stringContents | |
print(text) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment