Skip to content

Instantly share code, notes, and snippets.

@shadda
Created August 27, 2015 04:45
Show Gist options
  • Select an option

  • Save shadda/7116dc72999f67dcab95 to your computer and use it in GitHub Desktop.

Select an option

Save shadda/7116dc72999f67dcab95 to your computer and use it in GitHub Desktop.
DataManager.getSysDeviceCompatibility { (data) -> Void in
var parseError: NSError?
let parsedObject: AnyObject? = NSJSONSerialization.JSONObjectWithData(data,
options: NSJSONReadingOptions.AllowFragments,
error:&parseError)
//2
if let devices = parsedObject as? NSDictionary {
if let feed = devices["feed"] as? NSDictionary {
if let deviceEntry = feed["entry"] as? NSArray {
if let firstEntry = deviceEntry[0] as? NSDictionary {
if let imname = firstEntry["im:name"] as? NSDictionary {
if let deviceName = imname["label"] as? NSString {
//3
println("Optional Binding: \(deviceName)")
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment