When synchronizing model objects, local CKRecord
s, and CKRecords
in CloudKit during swipe-to-delete, how can I make this as robust as possible? Error handling omitted for the sake of the example.
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { if editingStyle == .delete { let record = self.records[indexPath.row] privateDatabase.delete(withRecordID: record.recordID) { recordID, error in self.records.remove(at: indexPath.row) } } }
Since indexPath
could change due to other changes in the table view / collection view during the time it takes to delete the record from CloudKit, how could this be improved upon?