diff --git a/Examples/TableViewExample/TableViewExample/NestedTableViewController.swift b/Examples/TableViewExample/TableViewExample/NestedTableViewController.swift index 362119c..202e2ff 100644 --- a/Examples/TableViewExample/TableViewExample/NestedTableViewController.swift +++ b/Examples/TableViewExample/TableViewExample/NestedTableViewController.swift @@ -43,6 +43,7 @@ class NestedTableViewController: UITableViewController { elements: [ "👋🏻", "🎁", + "😊", ], key: "Second" ), @@ -52,13 +53,13 @@ class NestedTableViewController: UITableViewController { elements: [ "🎁", "👋🏻", + "🐩", ], key: "Second" ), StringArray( elements: [ "🌞", - "🐩", ], key: "First" ), diff --git a/Sources/Differ/Diff+UIKit.swift b/Sources/Differ/Diff+UIKit.swift index 1d20760..91800c5 100644 --- a/Sources/Differ/Diff+UIKit.swift +++ b/Sources/Differ/Diff+UIKit.swift @@ -143,7 +143,10 @@ beginUpdates() deleteRows(at: update.deletions, with: deletionAnimation) insertRows(at: update.insertions, with: insertionAnimation) - update.moves.forEach { moveRow(at: $0.from, to: $0.to) } + update.moves.forEach { + deleteRows(at: [$0.from], with: deletionAnimation) + insertRows(at: [$0.to], with: insertionAnimation) + } endUpdates() } @@ -315,10 +318,16 @@ beginUpdates() deleteRows(at: update.itemDeletions, with: rowDeletionAnimation) insertRows(at: update.itemInsertions, with: rowInsertionAnimation) - update.itemMoves.forEach { moveRow(at: $0.from, to: $0.to) } + update.itemMoves.forEach { + deleteRows(at: [$0.from], with: rowDeletionAnimation) + insertRows(at: [$0.to], with: rowInsertionAnimation) + } deleteSections(update.sectionDeletions, with: sectionDeletionAnimation) insertSections(update.sectionInsertions, with: sectionInsertionAnimation) - update.sectionMoves.forEach { moveSection($0.from, toSection: $0.to) } + update.sectionMoves.forEach { + deleteSections([$0.from], with: sectionDeletionAnimation) + insertSections([$0.to], with: sectionInsertionAnimation) + } endUpdates() } }