Why are image views sometimes not appearing in collection view cells?
<p>I just updated to Swift 3.</p>

<p>My collection views were working great before the update. I did the recommended changes to make the compiler happy, but now I'm having this problem.</p>

<p>Image views that are in my custom UICollectionViewCells are simply not appearing anymore. Neither programmatically generated image views nor prototype image views are appearing. </p>

<p>I've given the image views background colors to check if my images are nil. The background colors aren't appearing, so it is safe to assume the image views are not appearing at all.</p>

<p>The cells themselves ARE appearing. Each image view has a label underneath, and the label is displaying properly with the correct text.</p>

<p>The most confusing part is that sometimes the image views DO appear, but there seems to be no rhyme or reason as to why or when.</p>

<p>My code is pretty standard, but I'll go ahead and share it anyway:</p>

<pre><code>func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int {
    return searchClubs.count
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -&gt; UICollectionViewCell {

    let cell: HomeCollectionViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! HomeCollectionViewCell

    cell.barLabel.text = searchClubs[indexPath.row].name
    cell.imageCell.image = searchClubs[indexPath.row].image

    cell.imageCell.layer.masksToBounds = true
    cell.imageCell.layer.cornerRadius = cell.imageCell.frame.height / 2

    return cell

}

func feedSearchClubs(child: AnyObject) {

    let name = child.value(forKey: "Name") as! String    

    //Image
    let base64EncodedString = child.value(forKey: "Image")!
    let imageData = NSData(base64Encoded: base64EncodedString as! String, options: NSData.Base64DecodingOptions.ignoreUnknownCharacters)
    let image = UIImage(data:imageData! as Data)

    //Populate clubs array
    let club = Club.init(name: name, image: image!)
    self.searchClubs.append(club)

    DispatchQueue.main.async {
           self.collectionView.reloadData()
    }
}
</code></pre>