Skip to content

Commit d8b0b6b

Browse files
author
Mikhail Markin
committed
Adding support of mutable CellViewModels
Diff update: in case if moved items are equal, initial item is used for afterDeleteItems instead of final item. This allows to keep CellViewModel assigned to UICell.
1 parent 4ecd106 commit d8b0b6b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
55

66
#### Master
77

8+
* Added support of mutable CellViewModels.
9+
810
## [4.0.1](https://github.com/RxSwiftCommunity/RxDataSources/releases/tag/4.0.1)
911

1012
* Fixes Carthage integration and reverts static frameworks to dynamic frameworks.

Sources/Differentiator/Diff.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,10 @@ public enum Diff {
623623
let finalItem = finalItemCache[finalItemIndex.sectionIndex][finalItemIndex.itemIndex]
624624
if finalItem != initialSections[i].items[j] {
625625
updatedItems.append(ItemPath(sectionIndex: i, itemIndex: j))
626+
afterDeleteItems.append(finalItem)
627+
} else {
628+
afterDeleteItems.append(initialSections[i].items[j])
626629
}
627-
afterDeleteItems.append(finalItem)
628630
default:
629631
try precondition(false, "Unhandled case")
630632
}

0 commit comments

Comments
 (0)