Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mblhaunted/fa9d6bc974d9c39d05fd5842537f30c7 to your computer and use it in GitHub Desktop.
Save mblhaunted/fa9d6bc974d9c39d05fd5842537f30c7 to your computer and use it in GitHub Desktop.
swift is really terrible
// get subject data sources
let urlAddress: String = "http://127.0.0.1:5000/subjects"
guard let url = URL(string: urlAddress) else {
print("cannot create url")
return
}
let urlRequest = URLRequest(url: url)
let config = URLSessionConfiguration.default
let session = URLSession(configuration: config)
// actually make the fucking request
let task = session.dataTask(with: urlRequest, completionHandler: { (data, response, error) in
print(response)
})
task.resume()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment