CollectionSectionViewModel
public struct CollectionSectionViewModel : DiffableViewModel
View model for a collection view section.
-
The key used by the diffing algorithm to uniquely identify this section. If you are using automatic diffing on the
CollectionViewDriver(which is enabled by default) you are required to provide a key that uniquely identifies this section.Typically you want to base this diffing key on data that is stored in the model. For example:
public var diffingKey = { group.identifier }Declaration
Swift
public var diffingKey: String -
Returns
trueif this section has zero cell view models,falseotherwise.Declaration
Swift
public var isEmpty: Bool { get } -
Initializes a collection view section view model.
Declaration
Swift
public init( diffingKey: String?, cellViewModels: [CollectionCellViewModel], headerViewModel: CollectionSupplementaryViewModel? = nil, footerViewModel: CollectionSupplementaryViewModel? = nil )Parameters
diffingKeya
Stringkey unique to this section that is used to diff sections automatically. Pass innilif you are not using automatic diffing on this collection.cellViewModelsthe cells in this section.
headerViewModelthe header view model (defaults to
nil).footerViewModelthe footer view model (defaults to
nil).
View on GitHub
CollectionSectionViewModel Structure Reference