Slide 29
Slide 29 text
// here's the definition:
func dataTaskWithURL(
url: NSURL,
completion: ((NSData!, NSURLResponse!, NSError!) -> Void)?
) -> NSURLSessionDataTask
// let's use it:
session.dataTaskWithURL("http://bit.ly/1IPyYmP") { data, response, error in
if error != nil {
// something went wrong
} else {
// we can more or less safely use data and response now
}
}.resume()