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 and detailTextLabel
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "trendingCell", for: indexPath)
print(self.array[indexPath.row])
cell.textLabel?.text = (self.array[indexPath.row]["title"] as! String)
cell.detailTextLabel?.text = (self.array[indexPath.row]["username"] as! String)
Alamofire.request("http://xxxxxxx.com/uploads/" + (self.array[indexPath.row]["cover"] as! String)).responseImage { response in
if let image = response.result.value {
cell.imageView?.image = image
}
}
return cell
}
cell.imageView?.image = image
called? Do you have any error logs in console? Iscell.imageView
not nil? – Bawdyresponse
is valid or not, by providing aprint(response)
inside your completion block? – DebimageView.af_setImage(
and also printresponse
– Britneybritni