При добавлении нескольких объектов CoreData в main context они прилетают в NSFetchedResultController не по порядку. Вследствие этого происходят ошибка при анимации добавления/удаления строк в таблице NSTableView.
for i in 0...10 {
let note1 = Note(entity: self.entityDescription, insertInto: context)
note1.modificationTime = Date()
note1.text = "note = \(i)"
note1.bookmarked = true
note1.uniqueID = UUID().uuidString
}
логи:
Class NoteListViewController
- count of object = Optional(11)
- insert object = Optional("note = 9") at IndexPath = Optional([0, 1])
Class NoteListViewController
- count of object = Optional(11)
- insert object = Optional("note = 7") at IndexPath = Optional([0, 3])
Class NoteListViewController
- count of object = Optional(11)
- insert object = Optional("note = 8") at IndexPath = Optional([0, 2])
Class NoteListViewController
- count of object = Optional(11)
- insert object = Optional("note = 5") at IndexPath = Optional([0, 5])
Class NoteListViewController
- count of object = Optional(11)
- insert object = Optional("note = 6") at IndexPath = Optional([0, 4])
Class NoteListViewController
- count of object = Optional(11)
- insert object = Optional("note = 3") at IndexPath = Optional([0, 7])
Class NoteListViewController
- count of object = Optional(11)
- insert object = Optional("note = 2") at IndexPath = Optional([0, 8])
Class NoteListViewController
- count of object = Optional(11)
- insert object = Optional("note = 4") at IndexPath = Optional([0, 6])
Class NoteListViewController
- count of object = Optional(11)
- insert object = Optional("note = 10") at IndexPath = Optional([0, 0])
Class NoteListViewController
- count of object = Optional(11)
- insert object = Optional("note = 1") at IndexPath = Optional([0, 9])
Class NoteListViewController
- count of object = Optional(11)
- insert object = Optional("note = 0") at IndexPath = Optional([0, 10])
class NOTES_LIST_VIEW_CONTROLLER -> func controllerDidChangeContent()