UICollectionView
public extension UICollectionView
-
Convenience initializer for simple
UICollectionViewwithUICollectionViewFlowLayoutlayout.Declaration
Swift
convenience init(frame: CGRect = .zero, delegate: UICollectionViewDelegate, spacing: CGFloat = 0)Parameters
frameThe frame rectangle for the collection view. Passed as-is when creating
UICollectionView. Defaults to.zerodelegateDelegate to receive events from
UICollectionView.spacingSpacing value in points between layed items. Defaults to 0.0
-
Convenience initializer for
UICollectionViewwith providedUICollectionViewFlowLayoutDeclaration
Swift
convenience init(frame: CGRect = .zero, delegate: UICollectionViewDelegate, layout: UICollectionViewFlowLayout)Parameters
frameThe frame rectangle for the collection view. Passed as-is when creating
UICollectionView. Defaults to.zerodelegateDelegate to receive events from
UICollectionView.layoutCustom
UICollectionViewFlowLayoutdescribing how to layout items inUICollectionView. -
Convenience function to setup
UICollectionViewwith reusable cell and data source.Declaration
Swift
func configureWith(_ cellType: UICollectionViewCell.Type, dataSource: UICollectionViewDataSource)Parameters
cellTypeSingle cell type to be used and reused within
UICollectionView.dataSourceData source to provide data based on associated callbacks.
-
Convenience function to setup
UICollectionViewwith reusable cells and data source.Declaration
Swift
func configureWith(_ cellTypes: [UICollectionViewCell.Type], dataSource: UICollectionViewDataSource)Parameters
cellTypesArray of cell types to be used and reused within
UICollectionView.dataSourceData source to provide data based on associated callbacks.
View on GitHub
UICollectionView Extension Reference