UICollectionView

class UICollectionView : UIScrollView, UIDataSourceTranslating
  • SwifterSwift: Index path of last item in collectionView.

    Declaration

    Swift

    public var indexPathForLastItem: IndexPath? { get }
  • SwifterSwift: Index of last section in collectionView.

    Declaration

    Swift

    public var lastSection: Int { get }
  • SwifterSwift: Number of all items in all sections of collectionView.

    Declaration

    Swift

    public func numberOfItems() -> Int

    Return Value

    The count of all rows in the collectionView.

  • SwifterSwift: IndexPath for last item in section.

    Declaration

    Swift

    public func indexPathForLastItem(inSection section: Int) -> IndexPath?

    Parameters

    section

    section to get last item in.

    Return Value

    optional last indexPath for last item in section (if applicable).

  • SwifterSwift: Reload data with a completion handler.

    Declaration

    Swift

    public func reloadData(_ completion: @escaping () -> Void)

    Parameters

    completion

    completion handler to run after reloadData finishes.

  • SwifterSwift: Dequeue reusable UICollectionViewCell using class name.

    Declaration

    Swift

    public func dequeueReusableCell<T>(withClass name: T.Type, for indexPath: IndexPath) -> T where T : UICollectionViewCell

    Parameters

    name

    UICollectionViewCell type.

    indexPath

    location of cell in collectionView.

    Return Value

    UICollectionViewCell object with associated class name.

  • SwifterSwift: Dequeue reusable UICollectionReusableView using class name.

    Declaration

    Swift

    public func dequeueReusableSupplementaryView<T>(ofKind kind: String, withClass name: T.Type, for indexPath: IndexPath) -> T where T : UICollectionReusableView

    Parameters

    kind

    the kind of supplementary view to retrieve. This value is defined by the layout object.

    name

    UICollectionReusableView type.

    indexPath

    location of cell in collectionView.

    Return Value

    UICollectionReusableView object with associated class name.

  • SwifterSwift: Register UICollectionReusableView using class name.

    Declaration

    Swift

    public func register<T>(supplementaryViewOfKind kind: String, withClass name: T.Type) where T : UICollectionReusableView

    Parameters

    kind

    the kind of supplementary view to retrieve. This value is defined by the layout object.

    name

    UICollectionReusableView type.

  • SwifterSwift: Register UICollectionViewCell using class name.

    Declaration

    Swift

    public func register<T>(nib: UINib?, forCellWithClass name: T.Type) where T : UICollectionViewCell

    Parameters

    nib

    Nib file used to create the collectionView cell.

    name

    UICollectionViewCell type.

  • SwifterSwift: Register UICollectionViewCell using class name.

    Declaration

    Swift

    public func register<T>(cellWithClass name: T.Type) where T : UICollectionViewCell

    Parameters

    name

    UICollectionViewCell type.

  • SwifterSwift: Register UICollectionReusableView using class name.

    Declaration

    Swift

    public func register<T>(nib: UINib?, forSupplementaryViewOfKind kind: String, withClass name: T.Type) where T : UICollectionReusableView

    Parameters

    nib

    Nib file used to create the reusable view.

    kind

    the kind of supplementary view to retrieve. This value is defined by the layout object.

    name

    UICollectionReusableView type.

  • SwifterSwift: Register UICollectionViewCell with .xib file using only its corresponding class. Assumes that the .xib filename and cell class has the same name.

    Declaration

    Swift

    public func register<T: UICollectionViewCell>(nibWithCellClass name: T.Type, at bundleClass: AnyClass? = nil)

    Parameters

    name

    UICollectionViewCell type.

    bundleClass

    Class in which the Bundle instance will be based on.