Skip to content

Instantly share code, notes, and snippets.

Created September 7, 2014 07:34
Show Gist options
  • Save anonymous/6da26c9f36d7a04d690c to your computer and use it in GitHub Desktop.
Save anonymous/6da26c9f36d7a04d690c to your computer and use it in GitHub Desktop.
// Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true)
let url = NSURL(string: "http://yo.ngrok.com/test")
let urlRequest = NSURLRequest(URL: url)
let postData = NSData()
let uploadDataTask = NSURLSession.sharedSession().uploadTaskWithRequest(urlRequest, fromData: postData) { data, response, error in
// handle response data, response, and error
let json = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil) // actually handle error
}
uploadDataTask.resume()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment