Skip to content

Instantly share code, notes, and snippets.

@J7mbo
Created August 8, 2018 14:41
Show Gist options
  • Save J7mbo/53c0adf836bc4a92ada76d4338ff73d2 to your computer and use it in GitHub Desktop.
Save J7mbo/53c0adf836bc4a92ada76d4338ff73d2 to your computer and use it in GitHub Desktop.
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