这是我的Swift 3代码。我需要将通过Kingfisher缓存下载的图像放入一个数组中。实际上,图像现在显示在cell.itemImage中,但我无法将这些图像放入UIImage数组中。
有人能帮忙吗?
有人能帮忙吗?
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
{
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! ViewItemsCVC
let Currency = UserDefaults.standard.string(forKey: "currency")
cell.NameLabel.text = self.itemName[indexPath.row]
cell.PriceLabel.text = "\(Currency ?? "INR") \(self.itemPrice[indexPath.row])"
let resource = ImageResource(downloadURL: URL(string: self.FullLink[indexPath.row])!, cacheKey: self.FullLink[indexPath.row])
cell.itemImage?.kf.setImage(with: resource)
return cell
}