How do I set cell spacing in a section of UICollectionView
? I know there is a property minimumInteritemSpacing
I have set it to 5.0 still the spaci
Select CollectionView in your storyboard and go to size inspector and set min spacing for cells and lines as 5
lazy var collectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
//Provide Width and Height According to your need
let width = UIScreen.main.bounds.width / 4
let height = UIScreen.main.bounds.height / 10
layout.itemSize = CGSize(width: width, height: height)
//For Adjusting the cells spacing
layout.minimumInteritemSpacing = 5
layout.minimumLineSpacing = 5
return UICollectionView(frame: self.view.frame, collectionViewLayout: layout)
}()