Swift 2 Cookbook by Kyle Begeman

Swift 2 Cookbook by Kyle Begeman

Author:Kyle Begeman [Begeman, Kyle]
Language: eng
Format: azw3, pdf
Publisher: Packt Publishing
Published: 2016-03-29T16:00:00+00:00


The total variable will be used afterwards, now the only thing you need to do is check that we could receive the response as we expected. Only one request might not be enough to do a benchmark, in which case we need to go to the line where we are inspecting the data argument and add the following code: total++ XCPCaptureValue("total",total) var err: NSError? var firstResponse = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as [[String:AnyObject]]? for response in firstResponse!{ for (key, value) in response{ if (key as NSString).containsString("_url") && value is String{ let valueString = value as String if !(valueString as NSString).containsString("{"){ let _url = NSURL(string: value as String)! let _request = NSURLRequest(URL: _url) NSURLConnection.sendAsynchronousRequest(_request, queue: NSOperationQueue(), completionHandler: { (_response, _data, err) -> Void in total = total + 1 total XCPCaptureValue("total",total) }) } } } }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.