@@ -26,22 +26,18 @@ class MasterViewController: UITableViewController, DBClientInjectable {
26
26
self . objects. append ( contentsOf: initial)
27
27
self . tableView. reloadData ( )
28
28
29
- case . update( deletions: let deletions, insertions: let insertions, modifications: let modifications) :
29
+ case . change( objects: let objects, deletions: let deletions, insertions: let insertions, modifications: let modifications) :
30
+ self . objects = objects
30
31
self . tableView. beginUpdates ( )
31
32
32
33
let insertedIndexPaths = insertions. map { IndexPath ( row: $0. index, section: 0 ) }
33
- insertions. forEach { index, object in self . objects. insert ( object, at: index) }
34
34
self . tableView. insertRows ( at: insertedIndexPaths, with: . automatic)
35
35
36
36
let deletedIndexPaths = deletions. map { IndexPath ( row: $0, section: 0 ) }
37
- deletions. forEach { self . objects. remove ( at: $0) }
38
37
self . tableView. deleteRows ( at: deletedIndexPaths, with: . automatic)
39
38
40
39
let updatedIndexPaths = modifications. map { IndexPath ( row: $0. index, section: 0 ) }
41
40
self . tableView. reloadRows ( at: updatedIndexPaths, with: . automatic)
42
- modifications. forEach { index, object in
43
- self . objects. insert ( object, at: index)
44
- }
45
41
46
42
self . tableView. endUpdates ( )
47
43
0 commit comments