Hi Everyone
I have an array with images in being displayed by a collection view. I am trying to use code to select one of the cells at random and change the alpha setting of the image so it disappears and revels what is behind it. I have been staring at the screen for days and my brain is melting. I have tried hundreds of techniques and nothing is working. Any advice would be appreciated. Relevant code is below. I am a new Swift comrade so apologies if this is simple.
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! CollectionViewCell
cell.yellowSquare.image = cellImages[indexPath.item]
let randomcell = cellImages.randomElement()
print(randomcell!)
if randomcell == UIImage(named: "gridsquare") {
cell.alpha = 0
}