Created
February 3, 2015 19:11
-
-
Save licvido/aca18f5bbd38e7e8e874 to your computer and use it in GitHub Desktop.
SWIFT: HTTP request
This file contains 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 url = NSURL(string: "http://www.example.com") | |
let request = NSURLRequest(URL: url!) | |
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {(response, data, error) in | |
// ... | |
} |
This file contains 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 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