Skip to content

Instantly share code, notes, and snippets.

@JohnProg
Forked from licvido/NSURLConnection.swift
Last active August 29, 2015 14:15
Show Gist options
  • Save JohnProg/62cef3103205e753b9ef to your computer and use it in GitHub Desktop.
Save JohnProg/62cef3103205e753b9ef to your computer and use it in GitHub Desktop.
let url = NSURL(string: "http://www.example.com")
let request = NSURLRequest(URL: url!)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {(response, data, error) in
// ...
}
let url = NSURL(string: "http://www.example.com")
let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {(data, response, error) in
// ...
}
task.resume()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment