This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Pure function mapping new state to a new `TableViewModel`. This is invoked each time the state updates | |
/// in order for ReactiveLists to update the UI. | |
static func viewModel(forState groups: [ToolGroup]) -> TableViewModel { | |
// Create a section for every tool group | |
let sections: [TableSectionViewModel] = groups.map { group in | |
// Create a single cell for every tool | |
let cellViewModels = group.tools.map { ToolTableCellModel(tool: $0) } | |
return TableSectionViewModel( | |
headerTitle: group.name, | |
headerHeight: 44, |
OlderNewer