I am a beginner in iOS development, and I am following a tutorial to implement collection view.
Here is the screenshot of that app :
I want to make that gap between items as close as possible. I have tried to implement the code below:
struct StoryBoard {
static let leftAndRightPaddings : CGFloat = 1.0
static let numberOfItemsPerRow : CGFloat = 3.0
}
let collectionViewWidth = collectionView?.frame.width
let itemWidth = (collectionViewWidth! - StoryBoard.leftAndRightPaddings) / StoryBoard.numberOfItemsPerRow
let layout = collectionViewLayout as! UICollectionViewFlowLayout
layout.itemSize = CGSize(width: itemWidth, height: itemWidth)
I have also changed the minimum spacing for cell and line to 0.1 in main storyboard like this:
but the gap is still big. what went wrong in here?