After using my old way of using collectionView I'm using now Apple code snippet for collectionView. The problem is that I can't implement my code for Cells spacing and that exact 3 cells for example should be in a row.
Here's my old code for cell spacing (now it's not working idk why..)
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let width = collectionView.frame.width / 3 - 1 // number of cells in a row. now it's 3
return CGSize(width: width, height: width)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 1.0
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 1.0
}
How I could make everything look better than it's now? Because now cell number in a row depends on iPhone model. Also, spacing depends on iPhone model too.