I am using
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) ->
The problem is that in the storyboard your collection view's Estimate Size is configured to Automatic:
You need to set it to None if you want your sizeForItemAt implementation to be obeyed rather than the internal constraints.
sizeForItemAt