Search code examples
iosswiftxcodeuicollectionviewcellxcode9

How to register a custom UICollectinViewCell into a UICollectionView built inside a custom view in a xib file


This is how I tried to do it but didn't work and the output is a blank collection view as you see in the simulator.

I would appreciate any help. Thanks This is the code of the collectionViewCell

enter image description here

enter image description here


Solution

  • on DonationProgramCell.swift add Property Observers to titleText property like this

    var titleText = "" {
            willSet {
                itemTitle.text = newValue
            }
        }
    

    also make sure that the itemTitle IBOutlet Label has right constraints