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 true if 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

    cellViewModels

    the cell models for the only section in this table.

  • Initializes a table view model with the sections provided. Optionally accepts the sectionIndexTitles for this table view.

    Declaration

    Swift

    public init(sectionModels: [TableSectionViewModel], sectionIndexTitles: [String]? = nil, defaultRowHeight: CGFloat = 44.0)

    Parameters

    sectionModels

    the sections that need to be shown in this table view.

    sectionIndexTitles

    the section index titles for this table view.

  • Returns the section model at the specified index or nil if no such section exists.

    Declaration

    Swift

    public subscript(ifExists section: Int) -> TableSectionViewModel? { get }

    Parameters

    section

    the index for the section that is being retrieved

  • Returns the cell view model at the specified index path or nil if no such cell exists.

    Declaration

    Swift

    public subscript(ifExists indexPath: IndexPath) -> TableCellViewModel? { get }

    Parameters

    indexPath

    the index path for the cell that is being retrieved