CollectionCellViewModel

public protocol CollectionCellViewModel : DiffableViewModel, ReusableCellViewModelProtocol

View model for the individual cells of a UICollectionView.

  • CollectionViewDriver will automatically apply an accessibilityIdentifier to the cell based on this format

    Declaration

    Swift

    var accessibilityFormat: CellAccessibilityFormat { get }
  • shouldHighlight Default implementation

    Whether or not this cell should be highlighted.

    Default Implementation

    Default implementation, returns true.

    Declaration

    Swift

    var shouldHighlight: Bool { get }
  • didSelect Default implementation

    Invoked when a cell has been selected.

    Default Implementation

    Default implementation, returns nil.

    Declaration

    Swift

    var didSelect: DidSelectClosure? { get }
  • didDeselect Default implementation

    Invoked 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.