Slide 17
Slide 17 text
token = dogs.addNotificationBlock { (change: RealmCollectionChange) in
switch change {
case let .Initial(change):
self.tableView.reloadData()
case let .Update(change, deletions, insertions, modifications):
self.tableView
.beginUpdates()
self.tableView
.deleteRowsAtIndexPaths(
deletions.map { NSIndexPath(forRow: $0, inSection: 0) },
withRowAnimation: .Automatic)
self.tableView
.insertRowsAtIndexPaths(
insertions.map { NSIndexPath(forRow: $0, inSection: 0) },
withRowAnimation: .Automatic)
self.tableView.endUpdates()
...