From 621c69d734ff7f20d400c41e784d3d8c58175a0c Mon Sep 17 00:00:00 2001 From: BAN Jun Date: Thu, 18 Jan 2018 18:03:42 +0900 Subject: [PATCH 1/2] crash example --- .../TableViewExample/NestedTableViewController.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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" ), From 32eb0bc3b61f219c8218f704b78defa7967e9698 Mon Sep 17 00:00:00 2001 From: BAN Jun Date: Fri, 19 Jan 2018 14:49:40 +0900 Subject: [PATCH 2/2] avoid using moveRows and moveSections by separating them into deletions followed by insertions *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attempt to create two animations for cell --- Sources/Differ/Diff+UIKit.swift | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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() } }