UICollectionView

public extension UICollectionView
  • Registers a cell to be used by a UICollectionView.

    Declaration

    Swift

    func register<T>(cell cellType: T.Type) where T : UICollectionViewCell, T : NibLoadable

    Parameters

    cellType

    A nibloadable collection view cell type to take the identifier and nib from.

  • Registers a header to be used by a UICollectionView.

    Declaration

    Swift

    func register<T>(header headerType: T.Type) where T : UICollectionReusableView, T : NibLoadable

    Parameters

    headerType

    A nibloadable reusable view type to take the identifier and nib from.

  • Registers a footer to be used by a UICollectionView.

    Declaration

    Swift

    func register<T>(footer footerType: T.Type) where T : UICollectionReusableView, T : NibLoadable

    Parameters

    footerType

    A nibloadable reusable view type to take the identifier and nib from.

  • Returns a reusable cell of the type specified to be used and adds it to the UICollectionView in the indexPath specified.

    Declaration

    Swift

    func dequeue<T>(cell cellType: T.Type, for indexPath: IndexPath) -> T? where T : UICollectionViewCell

    Parameters

    cellType

    A collection cell to take the identifier from.

    indexPath

    IndexPath where to add the cell to the collection view.

  • Returns a reusable header of the type specified to be used and adds it to the UICollectionView in the indexPath specified.

    Declaration

    Swift

    func dequeue<T>(header headerType: T.Type, for indexPath: IndexPath) -> T? where T : UICollectionReusableView

    Parameters

    headerType

    A collection reusable header view to take the identifier from.

  • Returns a reusable footer of the type specified to be used and adds it to the UICollectionView in the indexPath specified.

    Declaration

    Swift

    func dequeue<T>(footer footerType: T.Type, for indexPath: IndexPath) -> T? where T : UICollectionReusableView

    Parameters

    footerType

    AA collection reusable footer view to take the identifier from.