Created
August 27, 2015 04:45
-
-
Save shadda/7116dc72999f67dcab95 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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