I am using AlamofireImages to try to download an image from a server and display it in my table view cell, this is what I got, but my images does not appear, just the textLabel
Swift-5 Supported Code That Work Perfectly
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tblView.dequeueReusableCell(withIdentifier: "cell") as! TableViewCell
cell.lblName.text = arrData[indexPath.row]["name"] as? String
let imageUrl = arrData[indexPath.row]["imageUrl"] as? String
Alamofire.request(imageUrl!, method: .get).response { response in
guard let image = UIImage(data:response.data!) else {
// Handle error
return
}
let imageData = image.jpegData(compressionQuality: 1.0)
cell.imgCourses.image = UIImage(data : imageData!)
}
return cell
}