Skip to content

Instantly share code, notes, and snippets.

@acwright
Last active December 9, 2019 08:42
Show Gist options
  • Select an option

  • Save acwright/3ac99c6b62a1dc16ec2a08714e746e48 to your computer and use it in GitHub Desktop.

Select an option

Save acwright/3ac99c6b62a1dc16ec2a08714e746e48 to your computer and use it in GitHub Desktop.
Introducing Pinball 2
try? URLSession.shared.dataTask(for: endpoint) { (data, response, error) in
// Do something with the response…
}
// Or using Combine…
if #available(OSX 10.15, *) {
let publisher = try? URLSession.shared.dataTaskPublisher(for: endpoint)
// Do something with the Combine Publisher
} else {
// Fallback on earlier versions
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment