Skip to content

Instantly share code, notes, and snippets.

@joeltrew
Created April 11, 2016 15:15
Show Gist options
  • Save joeltrew/5072f32ec66fbdb6b16df2bcc3715455 to your computer and use it in GitHub Desktop.
Save joeltrew/5072f32ec66fbdb6b16df2bcc3715455 to your computer and use it in GitHub Desktop.
var results = [NSDictionary]()
if let path = NSBundle.mainBundle().pathForResource("output", ofType: "json") {
do {
let jsonData = try NSData(contentsOfFile: path, options: NSDataReadingOptions.DataReadingMappedIfSafe)
do {
let jsonResult: NSDictionary = try NSJSONSerialization.JSONObjectWithData(jsonData, options: NSJSONReadingOptions.MutableContainers) as! NSDictionary
if let londonEvents = jsonResult["WALES"] as? [[String: AnyObject]] {
for event: [String: AnyObject] in londonEvents {
results.append(event)
}
}
} catch {}
} catch {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment