Created
November 17, 2014 03:18
-
-
Save aGupieWare/971e75181aa61a33371f to your computer and use it in GitHub Desktop.
Swift client, request item . . .
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
| let task = self.urlSession.dataTaskWithURL(endPointURL!, completionHandler: { (data, response, error) -> Void in | |
| // convert the JSON response data into a NSDictionary // | |
| var jsonParseError: NSError? | |
| var jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &jsonParseError) | |
| as NSDictionary | |
| var rawInventoryItems = jsonResult["data"] as Dictionary<String,String> | |
| dispatch_async(dispatch_get_main_queue()!, { () -> Void in | |
| // call our completion handler // | |
| responseHandler( error: nil, itemDescription: rawInventoryItems["description"]) | |
| }) | |
| }) | |
| task.resume() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment