-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSection.swift
More file actions
28 lines (24 loc) · 772 Bytes
/
Section.swift
File metadata and controls
28 lines (24 loc) · 772 Bytes
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
//
// Section.swift
// FastAdapter
//
// Created by Fabian Terhorst on 22.07.18.
// Copyright © 2018 everHome. All rights reserved.
//
public class Section<Itm: Item> {
public var header: Itm?
public var items: [Itm]
public var footer: Itm?
public var supplementaryItems: [String: Itm]?
public init(header: Itm? = nil, items: [Itm], footer: Itm? = nil, supplementaryItems: [String: Itm]? = nil) {
self.header = header
self.items = items
self.footer = footer
self.supplementaryItems = supplementaryItems
}
public func map(_ mapper: (Itm) -> Itm) {
self.header = self.header.map(mapper)
self.items = self.items.map(mapper)
self.footer = self.footer.map(mapper)
}
}