I'm trying to update the tableview cell with image from web api. As per the below link, I tried it but it is giving nil in image even though image exist.
Update table cell image asynchronously.
Below is my code please let me know where I'm missing it.
DispatchQueue.global(qos: .background).async { [weak self] () -> Void in
if let url = NSURL(string: "https://myantion.eu/data/sol.svg"){
if let data = NSData(contentsOf: url as URL) {
let imageAux = UIImage(data: data as Data)
DispatchQueue.main.async {
cell.imgFlag.image = imageAux
}
}
}
}
The imageAux gives me nil value even though image exist
As per the below suggestions, even tried using UIWebView still no result and below is the code:
> let fileURL:URL = URL(fileURLWithPath:
> "https://myantion.eu/data/sol.svg")
> let req = URLRequest(url: fileURL)
> DispatchQueue.main.async {
> cell.webVw.loadRequest(req)
> }
>
> }