-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathSectionViewModel.swift
44 lines (35 loc) · 1.01 KB
/
SectionViewModel.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Created by Jesse Squires
// https://www.jessesquires.com
//
// Documentation
// https://jessesquires.github.io/ReactiveCollectionsKit
//
// GitHub
// https://github.com/jessesquires/ReactiveCollectionsKit
//
// Copyright © 2019-present Jesse Squires
//
import Foundation
public struct SectionViewModel {
public let cellViewModels: [CellViewModel]
public let headerViewModel: SupplementaryViewModel?
public let footerViewModel: SupplementaryViewModel?
public init(cells: [CellViewModel],
header: SupplementaryViewModel? = nil,
footer: SupplementaryViewModel? = nil) {
self.cellViewModels = cells
self.headerViewModel = header
self.footerViewModel = footer
}
// TODO: get empty state correct
// https://github.com/plangrid/ReactiveLists/issues/122
}
extension SectionViewModel {
var headerTitle: String? {
self.headerViewModel?.title
}
var footerTitle: String? {
self.footerViewModel?.title
}
}