Skip to content

Instantly share code, notes, and snippets.

@gwennguihal
Created December 20, 2018 07:54
Show Gist options
  • Save gwennguihal/83c53bd18c8d3e1351e8c8abe8f61cc2 to your computer and use it in GitHub Desktop.
Save gwennguihal/83c53bd18c8d3e1351e8c8abe8f61cc2 to your computer and use it in GitHub Desktop.
public class SectionDescriptor: CollectionSectionDescribable {
private var lineSpacing = VerticalSpace.zero
private var horizontalInset: CGFloat = Inset.sectionDefault
public func lineSpacing(_ value: VerticalSpace) -> SectionDescriptor {
lineSpacing = value
return self
}
public func horizontalInset(_ value: Inset) -> SectionDescriptor {
horizontalInset = value
return self
}
public func sectionInset(_ collectionView: UICollectionView) -> UIEdgeInsets {
return UIEdgeInsets(top: 0, left: horizontalInset, bottom: 0, right: horizontalInset)
}
public func minimumLineSpacing(_ collectionView: UICollectionView, layout: UICollectionViewFlowLayout) -> CGFloat {
return lineSpacing
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment