CollectionViewModel

public struct CollectionViewModel

The view model that describes a UICollectionView.

  • The section view models for this collection view.

    Declaration

    Swift

    public let sectionModels: [CollectionSectionViewModel]
  • Returns true if this collection has all empty sections.

    Declaration

    Swift

    public var isEmpty: Bool { get }
  • Initializes a collection view model with the sections provided.

    Declaration

    Swift

    public init(sectionModels: [CollectionSectionViewModel])

    Parameters

    sectionModels

    the sections that need to be shown in this collection view.

  • Returns the section model at the specified index or nil if no such section exists.

    Declaration

    Swift

    public subscript(ifExists section: Int) -> CollectionSectionViewModel? { get }

    Parameters

    section

    the index for the section that is being retrieved

  • Returns the cell view model at the specified index path or nil if no such cell exists.

    Declaration

    Swift

    public subscript(ifExists indexPath: IndexPath) -> CollectionCellViewModel? { get }

    Parameters

    indexPath

    the index path for the cell that is being retrieved