UICollectionView
public extension UICollectionView
-
Convenience initializer for simple
UICollectionView
withUICollectionViewFlowLayout
layout.Declaration
Swift
convenience init(frame: CGRect = .zero, delegate: UICollectionViewDelegate, spacing: CGFloat = 0)
Parameters
frame
The frame rectangle for the collection view. Passed as-is when creating
UICollectionView
. Defaults to.zero
delegate
Delegate to receive events from
UICollectionView
.spacing
Spacing value in points between layed items. Defaults to 0.0
-
Convenience initializer for
UICollectionView
with providedUICollectionViewFlowLayout
Declaration
Swift
convenience init(frame: CGRect = .zero, delegate: UICollectionViewDelegate, layout: UICollectionViewFlowLayout)
Parameters
frame
The frame rectangle for the collection view. Passed as-is when creating
UICollectionView
. Defaults to.zero
delegate
Delegate to receive events from
UICollectionView
.layout
Custom
UICollectionViewFlowLayout
describing how to layout items inUICollectionView
. -
Convenience function to setup
UICollectionView
with reusable cell and data source.Declaration
Swift
func configureWith(_ cellType: UICollectionViewCell.Type, dataSource: UICollectionViewDataSource)
Parameters
cellType
Single cell type to be used and reused within
UICollectionView
.dataSource
Data source to provide data based on associated callbacks.
-
Convenience function to setup
UICollectionView
with reusable cells and data source.Declaration
Swift
func configureWith(_ cellTypes: [UICollectionViewCell.Type], dataSource: UICollectionViewDataSource)
Parameters
cellTypes
Array of cell types to be used and reused within
UICollectionView
.dataSource
Data source to provide data based on associated callbacks.