Skip to content

Instantly share code, notes, and snippets.

@olbrichj
Created March 21, 2018 11:15
Show Gist options
  • Save olbrichj/2fd3186d4be09e7770ccef68bbaaadec to your computer and use it in GitHub Desktop.
Save olbrichj/2fd3186d4be09e7770ccef68bbaaadec to your computer and use it in GitHub Desktop.
func fetch(url: URL) -> Promise<Data> {
return Promise { seal in
URLSession.shared.dataTask(with: url!) { data, _, error in
seal.resolve(data, error)
}.resume()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment