Created
August 8, 2018 14:41
-
-
Save J7mbo/53c0adf836bc4a92ada76d4338ff73d2 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
struct JsonDownloader | |
{ | |
public func downloadContentsOfUrl(_ url: URL) -> Promise<String> { | |
return Promise { resolve, reject in | |
let jsonData = try! Data(contentsOf: url) | |
let jsonData = try! JSONSerialization.jsonObject(with: response, options: []) as! [String: Any] | |
return resolve(url: jsonData['image_url']) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment