I'm working on project in swift 3 and as to cache the image url that I get from json response I use the kingfisher pod. But for some reason I'm not getting the image in my UICollectionViewCell at all (image not getting displaying). What am I missing here. My code as below:
extension TableViewCell: UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return arrayJson.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CollectionViewCell", for: indexPath) as! CollectionViewCell
cell.naeLabel.text = arrayJson[indexPath.row]?["title"].stringValue
let url = ImageResource(downloadURL: URL(string: (arrayJson[indexPath.row]?["url"].stringValue)!)!, cacheKey: (arrayJson[indexPath.row]?["url"].stringValue))
cell.ProfileimageView.kf.setImage(with: url)
return cell
}
}