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
trueif 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
sectionModelsthe sections that need to be shown in this collection view.
-
Returns the section model at the specified index or
nilif no such section exists.Declaration
Swift
public subscript(ifExists section: Int) -> CollectionSectionViewModel? { get }Parameters
sectionthe index for the section that is being retrieved
-
Returns the cell view model at the specified index path or
nilif no such cell exists.Declaration
Swift
public subscript(ifExists indexPath: IndexPath) -> CollectionCellViewModel? { get }Parameters
indexPaththe index path for the cell that is being retrieved
View on GitHub
CollectionViewModel Structure Reference