-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathSupplementaryHeaderViewModel.swift
40 lines (36 loc) · 1.13 KB
/
SupplementaryHeaderViewModel.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
//
// 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
import UIKit
/// Defines a view model that describes and configures a header view
/// for a section in the collection view.
public protocol SupplementaryHeaderViewModel: SupplementaryViewModel {
/// The collection view header element kind.
static var kind: SupplementaryViewKind { get }
}
extension SupplementaryHeaderViewModel {
/// Default implementation. Returns a section header kind.
public static var kind: SupplementaryViewKind {
CollectionViewConstants.headerKind
}
/// A default registration for this header view model for class-based views.
///
/// - Warning: Does not work for nib-based views.
public var registration: ViewRegistration {
ViewRegistration(
reuseIdentifier: self.reuseIdentifier,
supplementaryViewClass: self.viewClass,
kind: Self.kind
)
}
}