[swift] How to set UICollectionViewCell Width and Height programmatically

An other way is to set the value directly in the flow layout

    let layout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout
    layout.itemSize = CGSize(width: size, height: size)