Skip to content

Commit afb7977

Browse files
author
Mario Radonic
committed
Change AnimatableSectionModel's ItemType to IdentifiableType & Equatable
1 parent 7e35d4a commit afb7977

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

Sources/DataSources/AnimatableSectionModel.swift

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,23 @@
88

99
import Foundation
1010

11-
public struct AnimatableSectionModel<Section: Hashable, ItemType: Hashable>
12-
: Hashable
13-
, AnimatableSectionModelType
11+
public struct AnimatableSectionModel<Section: IdentifiableType, ItemType: protocol<IdentifiableType, Equatable>>
12+
: AnimatableSectionModelType
1413
, CustomStringConvertible {
15-
public typealias Item = IdentifiableValue<ItemType>
16-
public typealias Identity = Section
14+
public typealias Item = ItemType
15+
public typealias Identity = Section.Identity
1716

1817
public var model: Section
1918

2019
public var items: [Item]
2120

22-
public var identity: Section {
23-
return model
21+
public var identity: Section.Identity {
22+
return model.identity
2423
}
2524

2625
public init(model: Section, items: [ItemType]) {
2726
self.model = model
28-
self.items = items.map(IdentifiableValue.init)
27+
self.items = items
2928
}
3029

3130
public init(original: AnimatableSectionModel, items: [Item]) {
@@ -38,10 +37,6 @@ public struct AnimatableSectionModel<Section: Hashable, ItemType: Hashable>
3837
}
3938

4039
public var hashValue: Int {
41-
return self.model.hashValue
40+
return self.model.identity.hashValue
4241
}
4342
}
44-
45-
public func == <S, I>(lhs: AnimatableSectionModel<S, I>, rhs: AnimatableSectionModel<S, I>) -> Bool {
46-
return lhs.model == rhs.model
47-
}

0 commit comments

Comments
 (0)