In UICollectionViewDelegateFlowLayout when I am using:
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 0, height: 0)
}
It works fine.
But when I am trying :
CGSize(width: .zero, height: .zero)
It shows an error as:
Ambiguous use of 'init(width:height:)'
In fact :
CGSize(width: .zero, height: 0)
also works. It just adding both as .zero is not working.
The syntax
is not recommended anyway even if it works.
.zerois a static variable ofCGSizeand can be used properlyor even