app-architecture
app-architecture copied to clipboard
Fix typo preventing `UITableView` animations
In the switch below, deleteRows() or insertRows was not reached because of this typo.
switch (changeReason, newValue, oldValue) {
case let (Item.removed, _, (oldIndex as Int)?):
tableView.deleteRows(at: [IndexPath(row: oldIndex, section: 0)], with: .automatic)
case let (Item.added, (newIndex as Int)?, _):
tableView.insertRows(at: [IndexPath(row: newIndex, section: 0)], with: .automatic)
case let (Item.renamed, (newIndex as Int)?, (oldIndex as Int)?):
tableView.moveRow(at: IndexPath(row: oldIndex, section: 0), to: IndexPath(row: newIndex, section: 0))
tableView.reloadRows(at: [IndexPath(row: newIndex, section: 0)], with: .automatic)
default:
tableView.reloadData()
}
@chriseidhof can you review this?
This typo is also detected by the unit tests in the MVC project - testChangeNotificationHandling fails if you run the tests out of the box - this change fixes the test.