TableViewModel
public struct TableViewModel
The view model that describes a UITableView.
-
The default row height for this table view. The default value is 44.
Declaration
Swift
public let defaultRowHeight: CGFloat -
The section index titles for this table view.
Declaration
Swift
public let sectionIndexTitles: [String]? -
The section view models for this table view.
Declaration
Swift
public let sectionModels: [TableSectionViewModel] -
Returns
trueif this table has all empty sections.Declaration
Swift
public var isEmpty: Bool { get } -
Initializes a table view model with one section and the cell models provided via the initializer.
Declaration
Swift
public init(cellViewModels: [TableCellViewModel])Parameters
cellViewModelsthe cell models for the only section in this table.
-
Initializes a table view model with the sections provided. Optionally accepts the
sectionIndexTitlesfor this table view.Declaration
Swift
public init(sectionModels: [TableSectionViewModel], sectionIndexTitles: [String]? = nil, defaultRowHeight: CGFloat = 44.0)Parameters
sectionModelsthe sections that need to be shown in this table view.
sectionIndexTitlesthe section index titles for this table view.
-
Returns the section model at the specified index or
nilif no such section exists.Declaration
Swift
public subscript(ifExists section: Int) -> TableSectionViewModel? { 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) -> TableCellViewModel? { get }Parameters
indexPaththe index path for the cell that is being retrieved
View on GitHub
TableViewModel Structure Reference