CollectionViewDelegateFlowLayout

public protocol CollectionViewDelegateFlowLayout

CollectionViewDelegateFlowLayout

  • Asks 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.ItemStyle

    Parameters

    collectionView

    The collection view requesting the information

    gridLayout

    The layout

    indexPath

    The index path of the item to style

    Return Value

    A style to apply to the item

  • Asks 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) -> CGFloat

    Parameters

    collectionView

    The collection view requesting the information

    collectionViewLayout

    The layout

    section

    The section affected by this height

    Return Value

    The height to apply to the header view in the specified section

  • Asks 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) -> CGFloat

    Parameters

    collectionView

    The collection view requesting the information

    collectionViewLayout

    The layout

    section

    The section affected by this height

    Return Value

    The height to apply to the header view in the specified section

  • Asks 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) -> NSEdgeInsets

    Parameters

    collectionView

    The collection view requesting the information

    collectionViewLayout

    The layout

    section

    Thhe section that the return value will be applied to

    Return Value

    Edge insets for the specified section

  • Asks 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.RowTransform

    Parameters

    collectionView

    The collection requesting the information

    collectionViewLayout

    The layout

    section

    The section to transform

    Return Value

    The type of row transform to apply