Created
March 21, 2018 11:15
-
-
Save olbrichj/2fd3186d4be09e7770ccef68bbaaadec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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