@@ -86,7 +86,7 @@ extension Changeset {
86
86
87
87
extension Changeset {
88
88
89
- fileprivate func apply( original: [ S ] ) -> [ S ] {
89
+ fileprivate func apply( original: [ Section ] ) -> [ Section ] {
90
90
91
91
let afterDeletesAndUpdates = applyDeletesAndUpdates ( original: original)
92
92
let afterSectionMovesAndInserts = applySectionMovesAndInserts ( original: afterDeletesAndUpdates)
@@ -95,8 +95,8 @@ extension Changeset {
95
95
return afterItemInsertsAndMoves
96
96
}
97
97
98
- private func applyDeletesAndUpdates( original: [ S ] ) -> [ S ] {
99
- var resultAfterDeletesAndUpdates : [ SectionModelTypeWrapper < S > ] = SectionModelTypeWrapper . wrap ( original)
98
+ private func applyDeletesAndUpdates( original: [ Section ] ) -> [ Section ] {
99
+ var resultAfterDeletesAndUpdates : [ SectionModelTypeWrapper < Section > ] = SectionModelTypeWrapper . wrap ( original)
100
100
101
101
for index in updatedItems {
102
102
resultAfterDeletesAndUpdates [ index. sectionIndex] . items [ index. itemIndex] . updated = true
@@ -124,7 +124,7 @@ extension Changeset {
124
124
return SectionModelTypeWrapper . unwrap ( resultAfterDeletesAndUpdates)
125
125
}
126
126
127
- private func applySectionMovesAndInserts( original: [ S ] ) -> [ S ] {
127
+ private func applySectionMovesAndInserts( original: [ Section ] ) -> [ Section ] {
128
128
if !updatedSections. isEmpty {
129
129
fatalError ( " Section updates aren't supported " )
130
130
}
@@ -149,7 +149,7 @@ extension Changeset {
149
149
150
150
let totalCount = original. count + insertedSections. count
151
151
152
- var results : [ S ] = [ ]
152
+ var results : [ Section ] = [ ]
153
153
154
154
for index in 0 ..< totalCount {
155
155
if insertedSectionsIndexes. contains ( index) {
@@ -170,8 +170,8 @@ extension Changeset {
170
170
return results
171
171
}
172
172
173
- private func applyItemInsertsAndMoves( original: [ S ] ) -> [ S ] {
174
- var resultAfterInsertsAndMoves : [ S ] = original
173
+ private func applyItemInsertsAndMoves( original: [ Section ] ) -> [ Section ] {
174
+ var resultAfterInsertsAndMoves : [ Section ] = original
175
175
176
176
let sourceIndexesThatShouldBeMoved = Set ( movedItems. map { $0. from } )
177
177
let destinationToSourceMapping = Dictionary ( elements: self . movedItems, keySelector: { $0. to } , valueSelector: { $0. from } )
@@ -210,7 +210,7 @@ extension Changeset {
210
210
+ movedInSection[ sectionIndex]
211
211
- movedOutSection[ sectionIndex]
212
212
213
- var resultItems : [ S . Item ] = [ ]
213
+ var resultItems : [ Section . Item ] = [ ]
214
214
215
215
for index in 0 ..< totalCount {
216
216
let itemPath = ItemPath ( sectionIndex: sectionIndex, itemIndex: index)
@@ -229,7 +229,7 @@ extension Changeset {
229
229
}
230
230
}
231
231
232
- resultAfterInsertsAndMoves [ sectionIndex] = S ( original: section, items: resultItems)
232
+ resultAfterInsertsAndMoves [ sectionIndex] = Section ( original: section, items: resultItems)
233
233
}
234
234
235
235
return resultAfterInsertsAndMoves
0 commit comments