Swift 4 AlamofireImage with UITableView Cell

Of course your image will not show for you. Cause when Alamofire starts downloading your image its process in background thread. But you are working in Main Thread or UI Thread so you need to swap from background to Main Thread it will work for you.

Alamofire.request("http://xxxxxxx.com/uploads/" + (self.array[indexPath.row]["cover"] as! String)).responseImage { response in
       DispatchQueue.main.async {
            if let image = response.result.value {
                cell.imageView?.image = image
            }
        }
}

If you think it is difficulty for you to do this i recommend you to use this library called Kingfisher it will handle asynchronous loading images for you that make your cell's table run in smoothly.

Link: https://github.com/onevcat/Kingfisher


Using AlamofireImages

if let url = URL(string: "your url") {

    cell.imageView?.af_setImage(withURL:url, placeholderImage: nil, filter: nil,  imageTransition: .crossDissolve(0.2), runImageTransitionIfCached: false, completion: {response in
      // do stuff when is downloaded completely.
    })
}

Try this:

 Alamofire.request(imageUrl!, method: .get).response { response in
                    guard let image = UIImage(data:response.data!) else {
                        // Handle error
                        return
                    }
                    let imageData = UIImageJPEGRepresentation(image,1.0)
                    cell.myImage.image = UIImage(data : imageData!)
                }

This works fine for me.. Hope This will helpful.