I\'ve set the width of a cell(UICollectionViewCell) to be equal to the width of the UICollectionView and I\'m trying to do exactly the same thing with the UILabel that is includ
It doesn't work because by the time this method is called, the collection view already knows how big the cell should be because it has got it from the flow delegate method:
optional func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize
This is where you should be setting the size of your cells.