这是我的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
}