Skip to content

Instantly share code, notes, and snippets.

@regularberry
Last active September 29, 2018 23:49
Show Gist options
  • Select an option

  • Save regularberry/4b384d798247a443f56094b40940da0e to your computer and use it in GitHub Desktop.

Select an option

Save regularberry/4b384d798247a443f56094b40940da0e to your computer and use it in GitHub Desktop.
let url = URL(string: "http://0.0.0.0")!
let data = "Secret Message".data(using: .utf8)
let request = URLRequest(url: url)
let config = URLSessionConfiguration.background(withIdentifier: "uniqueId")
let session = URLSession(configuration: config, delegate: nil, delegateQueue: nil)
let task = session.uploadTask(with: request, from: data) { responseData, response, error in
print("We're done here")
}
task.resume()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment