UICollectionView

  • Mechanica

    Registers a nib object containing an UICollectionViewCell subclass conforming to Reusable & NibIdentifiable.

    Seealso

    register(_:forCellWithReuseIdentifier:)

    Declaration

    Swift

    public final func register<T: UICollectionViewCell>(cellType: T.Type) where T: NibReusable

    Parameters

    cellType

    the UICollectionViewCell subclass to register.

  • Mechanica

    Registers a class conforming to Reusable for use in creating new collection view cells.

    Seealso

    register(_:forCellWithReuseIdentifier:)

    Declaration

    Swift

    public final func register<T: UICollectionViewCell>(cellType: T.Type) where T: Reusable

    Parameters

    cellType

    The UICollectionViewCell subclass to register.

  • Mechanica

    Returns a reusable UICollectionViewCell object for the class inferred by the specified return-type.

    Note

    The cellType parameter can generally be omitted and infered by the return type, except when your type is in a variable and cannot be determined at compile time.

    Seealso

    dequeueReusableCell(withReuseIdentifier:for:)

    Declaration

    Swift

    public final func dequeueReusableCell<T: UICollectionViewCell>(for indexPath: IndexPath, cellType: T.Type = T.self) -> T where T: Reusable

    Parameters

    indexPath

    The index path specifying the location of the cell.

    cellType

    The cell class to dequeue.

    Return Value

    A Reusable UICollectionViewCell instance

  • Mechanica

    Registers a nib object containing an UICollectionReusableView subclass conforming to Reusable & NibIdentifiable as a supplementary view.

    Seealso

    register(_:,forSupplementaryViewOfKind:withReuseIdentifier:)

    Declaration

    Swift

    public final func register<T: UICollectionReusableView>(supplementaryViewType: T.Type, forSupplementaryViewOfKind kind: String) where T: NibReusable

    Parameters

    supplementaryViewType

    The UIView subclass to register as supplementary view.

    elementKind

    The kind of supplementary view to create.

  • Mechanica

    Registers a class conforming to Reusable for use in creating supplementary views for the collection view..

    Seealso

    register(_:,forSupplementaryViewOfKind:withReuseIdentifier:)

    Declaration

    Swift

    public final func register<T: UICollectionReusableView>(supplementaryViewType: T.Type, forSupplementaryViewOfKind kind: String) where T: Reusable

    Parameters

    supplementaryViewType

    the UIView (Reusable-conforming) subclass to register as supplementary view.

    elementKind

    The kind of supplementary view to create.

  • Mechanica

    Returns a reusable supplementary view for the class inferred by the return-type.

    Note

    The viewType parameter can generally be omitted and infered by the return type, except when your type is in a variable and cannot be determined at compile time.

    Seealso

    dequeueReusableSupplementaryView(ofKind:,withReuseIdentifier:for:)

    Declaration

    Swift

    public final func dequeueReusableSupplementaryView<T: UICollectionReusableView>(ofKind elementKind: String, for indexPath: IndexPath, viewType: T.Type = T.self) -> T where T: Reusable

    Parameters

    elementKind

    The kind of supplementary view to retrieve.

    indexPath

    The index path specifying the location of the cell.

    viewType

    The view class to dequeue

    Return Value

    A Reusable UICollectionReusableView instance