UICollectionViewFlowLayout
extension UICollectionViewFlowLayout
-
Returns a UICollectionViewFlowLayout initialized with the provided scroll direction, item spacing, line spacing, and section inset.
Declaration
Swift
public convenience init( scrollDirection: UICollectionView.ScrollDirection, itemSpacing: CGFloat = 10, lineSpacing: CGFloat = 10, sectionInset: UIEdgeInsets = .zero)Parameters
scrollDirectionThe scroll direction of the layout.
itemSpacingThe minimum spacing to use between items in the same row (optional, defaults to 10).
lineSpacingThe minimum spacing to use between lines of items in the grid (optional, defaults to 10).
sectionInsetThe margins used to lay out content in a section (optional, defaults to
.zero).Return Value
A UICollectionViewFlowLayout initialized with the provided scroll direction, item spacing, line spacing, and section inset.
-
Creates a vertical UICollectionViewFlowLayout.
Declaration
Swift
public static func vertical(itemSpacing: CGFloat = 10, lineSpacing: CGFloat = 10, sectionInset: UIEdgeInsets = .zero) -> UICollectionViewFlowLayoutParameters
itemSpacingThe minimum spacing between items in the same row (optional, defaults to 10).
lineSpacingThe minimum spacing between successive rows (optional, defaults to 10).
sectionInsetThe spacing at the outer edges of the section (optional, defaults to
.zero).Return Value
A vertical UICollectionViewFlowLayout with the specified item spacing, line spacing, and section inset.
-
Creates a horizontal UICollectionViewFlowLayout.
Declaration
Swift
public static func horizontal(itemSpacing: CGFloat = 10, lineSpacing: CGFloat = 10, sectionInset: UIEdgeInsets = .zero) -> UICollectionViewFlowLayoutParameters
itemSpacingThe minimum spacing between items in the same column (optional, defaults to 10).
lineSpacingThe minimum spacing between successive columns (optional, defaults to 10).
sectionInsetThe spacing at the outer edges of the section (optional, defaults to
.zero).Return Value
A vertical UICollectionViewFlowLayout with the specified item spacing, line spacing, and section inset.
View on GitHub
Install in Dash
UICollectionViewFlowLayout Extension Reference