Skip to content

Instantly share code, notes, and snippets.

View Ben-G's full-sized avatar
💭
💻

Benjamin Encz Ben-G

💭
💻
View GitHub Profile
@Ben-G
Ben-G / ReactiveListExample.swift
Last active February 6, 2018 19:09
Reactive List Example
/// 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,