I am using this code -:
private static func getJson(_ link: String, completion: @escaping (Json?) -> ()) {
let url = URL(string: "https://twitter.com/BCCI/status/1476041561288822788?s=20")!
URLSession.shared.dataTask(with: url) { data, response, error in
guard let data = data, error == nil else {
return completion(nil)
}
if let json = (try? JSONSerialization.jsonObject(with: data)) as? Json {
completion(json)
} else {
completion(nil)
}
}.resume()
}
I want to get json data and download the link