So i have a collectionViewController that I am trying to implement a grid layout in. I know that the sizeForItemAt controls the size but no matter how many times I play with it I just can't get it to be a three by three grid and it's really confusing me. Any help is greatly appreciated. I only added the sizeForItemAt method to save everyone some time.
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let width = (view.frame.width - 2)/3
return CGSize(width: width, height: width)
}
This is what my VC currently looks like