@@ -35,20 +35,22 @@ open class SPDiffableSection: NSObject, NSCopying {
35
35
Always shoud be uniq. But if it changed, diffable system remove old and insert new (not reload).
36
36
Identifier uses in `Hashable` and `Equatable` protocols.
37
37
*/
38
- public var identifier : String
38
+ public var identifier : SectionIdentifier
39
39
public var header : SPDiffableItem ?
40
40
public var footer : SPDiffableItem ?
41
41
42
42
public var items : [ SPDiffableItem ]
43
43
44
- public init ( identifier: String , header: SPDiffableItem ? = nil , footer: SPDiffableItem ? = nil , items: [ SPDiffableItem ] = [ ] ) {
44
+ // MARK: - Init
45
+
46
+ public init ( identifier: SectionIdentifier , header: SPDiffableItem ? = nil , footer: SPDiffableItem ? = nil , items: [ SPDiffableItem ] = [ ] ) {
45
47
self . identifier = identifier
46
48
self . header = header
47
49
self . footer = footer
48
50
self . items = items
49
51
}
50
52
51
- // MARK: Hashable and Equatable
53
+ // MARK: - Hashable and Equatable
52
54
53
55
public override var hash : Int {
54
56
var hasher = Hasher ( )
@@ -61,7 +63,7 @@ open class SPDiffableSection: NSObject, NSCopying {
61
63
return identifier == object. identifier
62
64
}
63
65
64
- // MARK: NSCopying
66
+ // MARK: - NSCopying
65
67
66
68
// Implemented becouse when using with collection,
67
69
// sometimes catch error about unregognized selector.
@@ -73,4 +75,8 @@ open class SPDiffableSection: NSObject, NSCopying {
73
75
items: self . items
74
76
)
75
77
}
78
+
79
+ // MARK: - Item Identifier
80
+
81
+ public typealias SectionIdentifier = String
76
82
}
0 commit comments