Ramotion/expanding-collection

Is there a way to set the space between cells?

junweimah opened this issue · 3 comments

I got the collection view up and running, but my project need to have the cells to be closer to each other, how do I set the space in between the cells?

Thanks.

On class PageCollectionLayout on PageCollectionLayout there is a function

fileprivate func commonInit(_ itemSize: CGSize) {
scrollDirection = .horizontal
minimumLineSpacing = 25
self.itemSize = itemSize
}

change the minimumLineSpacing as much as you want

what if i want to dynamically change the spacing to fit all different screen size? How do I do it?

Instead of saying something like 25 you can take UIScreen bounds and divide to as much as you want for example if you want 1/10 of the screen spacing UIScreen.main.bounds.width / 10
If you can't access it from the library pass it as a variable from viewdidload() on your view controller and set it inside the function