I have a CollectionView
which displays images to the user. I download these in the background, and when the download is complete I call the following func to update
You can simply use if collectionView.cellForItem(at: indexPath) == nil { }
. The collectionView will only return a cell if it is visible.
Or in your case specifically change:
let cell = followedCollectionView.cellForItemAtIndexPath(indexPath) as! FeaturedCitiesCollectionViewCell
to:
if let cell = followedCollectionView.cellForItemAtIndexPath(indexPath) as? FeaturedCitiesCollectionViewCell { }