CollectionCellViewModel
public protocol CollectionCellViewModel : DiffableViewModel, ReusableCellViewModelProtocol
View model for the individual cells of a UICollectionView
.
-
CollectionViewDriver
will automatically apply anaccessibilityIdentifier
to the cell based on this formatDeclaration
Swift
var accessibilityFormat: CellAccessibilityFormat { get }
-
shouldHighlight
Default implementationWhether or not this cell should be highlighted.
Default Implementation
Default implementation, returns
true
.Declaration
Swift
var shouldHighlight: Bool { get }
-
didSelect
Default implementationInvoked when a cell has been selected.
Default Implementation
Default implementation, returns
nil
.Declaration
Swift
var didSelect: DidSelectClosure? { get }
-
didDeselect
Default implementationInvoked when an accessory button is tapped.
Default Implementation
Default implementation, returns
nil
.Declaration
Swift
var didDeselect: DidDeselectClosure? { get }
-
Asks the cell model to update the
UICollectionViewCell
with the content in the cell model and return the updated cell.Declaration
Swift
func applyViewModelToCell(_ cell: UICollectionViewCell)
Parameters
cell
the cell which’s content need to be updated.