UICollectionView

public extension UICollectionView

Cell Nib

  • Simplifies header registration. Xib name must be the same as class name.

    Declaration

    Swift

    func registerNib(headerClass: UICollectionReusableView.Type)
  • Simplifies footer registration. Xib name must be the same as class name.

    Declaration

    Swift

    func registerNib(footerClass: UICollectionReusableView.Type)
  • Simplifies cell registration. Xib name must be the same as class name.

    Declaration

    Swift

    func registerNib(cellClass: UICollectionViewCell.Type)
  • Simplifies cell dequeue.

    Declaration

    Swift

    func dequeueCell<T>(_ class: T.Type, for indexPath: IndexPath) -> T where T : UICollectionViewCell
  • Simplifies configurable cell dequeue.

    Declaration

    Swift

    func dequeueConfigurableCell(class: (UICollectionViewCell & Configurable).Type, for indexPath: IndexPath) -> UICollectionViewCell & Configurable
  • Simplifies header dequeue. Specify type of variable on declaration so proper header will be dequeued. Example:

    let header: MyHeader = collectionView.dequeueHeader(for: indexPath)
    

    Declaration

    Swift

    func dequeueHeader<T>(_ class: T.Type, for indexPath: IndexPath) -> T where T : UICollectionReusableView
  • Simplifies configurable header dequeue.

    Example:

    let cell = collectionView.dequeueConfigurableHeader(class: MyHeaderClass.self, for: indexPath)
    

    Declaration

    Swift

    func dequeueConfigurableHeader(class: (UICollectionReusableView & Configurable).Type, for indexPath: IndexPath) -> UICollectionReusableView & Configurable
  • Simplifies footer dequeue.

    Declaration

    Swift

    func dequeueFooter<T>(_ class: T.Type, for indexPath: IndexPath) -> T where T : UICollectionReusableView
  • Simplifies configurable footer dequeue.

    Example:

    let cell = collectionView.dequeueConfigurableFooter(class: MyFooterClass.self, for: indexPath)
    

    Declaration

    Swift

    func dequeueConfigurableFooter(class: (UICollectionReusableView & Configurable).Type, for indexPath: IndexPath) -> UICollectionReusableView & Configurable