TableCellViewModel
public protocol TableCellViewModel : DiffableViewModel, ReusableCellViewModelProtocol
View model for the individual cells of a TableViewModel
.
-
TableViewDriver
will automatically apply anaccessibilityIdentifier
to the cell based on this format.Declaration
Swift
var accessibilityFormat: CellAccessibilityFormat { get }
-
rowHeight
Default implementationThe height of this cell.
Default Implementation
Default implementation, returns
nil
.Note
Ifnil
, theTableViewDriver
will fallback toTableViewModel.defaultRowHeight
.See
See also: TableViewModelDeclaration
Swift
var rowHeight: CGFloat? { get }
-
editingStyle
Default implementationThe editing style for this cell.
Default Implementation
Default implementation, returns
.none
.Declaration
Swift
var editingStyle: UITableViewCell.EditingStyle { get }
-
shouldHighlight
Default implementationWhether or not this cell should be highlighted.
Default Implementation
Default implementation, returns
true
.Declaration
Swift
var shouldHighlight: Bool { get }
-
shouldIndentWhileEditing
Default implementationWhether or not this cell should be indented while editing.
Default Implementation
Default implementation, returns
false
.Declaration
Swift
var shouldIndentWhileEditing: Bool { get }
-
willBeginEditing
Default implementationInvoked when a cell will begin being edited.
Default Implementation
Default implementation, returns
nil
.Declaration
Swift
var willBeginEditing: WillBeginEditingClosure? { get }
-
didEndEditing
Default implementationInvoked when cell editing has ended.
Default Implementation
Default implementation, returns
nil
.Declaration
Swift
var didEndEditing: DidEndEditingClosure? { get }
-
commitEditingStyle
Default implementationAsks the cell to commit the insertion/deletion.
Default Implementation
Default implementation, returns
nil
.Declaration
Swift
var commitEditingStyle: CommitEditingStyleClosure? { get }
-
didSelect
Default implementationInvoked when a cell has been selected.
Default Implementation
Default implementation, returns
nil
.Declaration
Swift
var didSelect: DidSelectClosure? { get }
-
accessoryButtonTapped
Default implementationInvoked when an accessory button is tapped.
Default Implementation
Default implementation, returns
nil
.Declaration
Swift
var accessoryButtonTapped: AccessoryButtonTappedClosure? { get }
-
Asks the cell model to update the
UITableViewCell
with the content in the cell model and return the updated cell.Declaration
Swift
func applyViewModelToCell(_ cell: UITableViewCell)
Parameters
cell
the cell which contents need to be updated.