CollectionViewDelegateFlowLayout
public protocol CollectionViewDelegateFlowLayout
CollectionViewDelegateFlowLayout
-
collectionView(_:flowLayout:styleForItemAt:)Default implementationAsks the delegate for the layout style for the item at the specified index path
Default Implementation
Declaration
Swift
func collectionView(_ collectionView: CollectionView, flowLayout: CollectionViewFlowLayout, styleForItemAt indexPath: IndexPath) -> CollectionViewFlowLayout.ItemStyleParameters
collectionViewThe collection view requesting the information
gridLayoutThe layout
indexPathThe index path of the item to style
Return Value
A style to apply to the item
-
collectionView(_:flowLayout:heightForHeaderInSection:)Default implementationAsks the delegate for the height of the header view in a specified section
Return 0 for no header view
Default Implementation
Declaration
Swift
func collectionView(_ collectionView: CollectionView, flowLayout collectionViewLayout: CollectionViewFlowLayout, heightForHeaderInSection section: Int) -> CGFloatParameters
collectionViewThe collection view requesting the information
collectionViewLayoutThe layout
sectionThe section affected by this height
Return Value
The height to apply to the header view in the specified section
-
collectionView(_:flowLayout:heightForFooterInSection:)Default implementationAsks the delegate for the height of the footer view in a specified section
Return 0 for no footer view
Default Implementation
Declaration
Swift
func collectionView(_ collectionView: CollectionView, flowLayout collectionViewLayout: CollectionViewFlowLayout, heightForFooterInSection section: Int) -> CGFloatParameters
collectionViewThe collection view requesting the information
collectionViewLayoutThe layout
sectionThe section affected by this height
Return Value
The height to apply to the header view in the specified section
-
collectionView(_:flowLayout:insetsForSectionAt:)Default implementationAsks the delegate for the insets for the content of the specified index path
Default Implementation
Declaration
Swift
func collectionView(_ collectionView: CollectionView, flowLayout collectionViewLayout: CollectionViewFlowLayout, insetsForSectionAt section: Int) -> NSEdgeInsetsParameters
collectionViewThe collection view requesting the information
collectionViewLayoutThe layout
sectionThhe section that the return value will be applied to
Return Value
Edge insets for the specified section
-
collectionView(_:flowLayout:rowTransformForSectionAt:)Default implementationAsks the delegate for a transform to apply to the content in each row the specified section, defaults to .none
Default Implementation
Declaration
Swift
func collectionView(_ collectionView: CollectionView, flowLayout collectionViewLayout: CollectionViewFlowLayout, rowTransformForSectionAt section: Int) -> CollectionViewFlowLayout.RowTransformParameters
collectionViewThe collection requesting the information
collectionViewLayoutThe layout
sectionThe section to transform
Return Value
The type of row transform to apply