Skip to content

Instantly share code, notes, and snippets.

@yccheok
Created July 23, 2021 05:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yccheok/35c31a29e7f9eebdccfdc7cdfe9fe724 to your computer and use it in GitHub Desktop.
Save yccheok/35c31a29e7f9eebdccfdc7cdfe9fe724 to your computer and use it in GitHub Desktop.
else if type == NSFetchedResultsChangeType.move {
// A hackish way to ensure PIN icon is updated.
if let newIndexPath = newIndexPath, let indexPath = indexPath {
if let plainNote = nsPlainNoteProvider.getNSPlainNote(newIndexPath), let noteCell = collectionView.cellForItem(at: indexPath) as? NoteCell {
noteCell.update(
plainNote,
selected: false,
animate: false
)
}
}
blockOperations.append(
BlockOperation(block: { [weak self] in
if let self = self, let newIndexPath = newIndexPath, let indexPath = indexPath {
self.collectionView.moveItem(at: indexPath, to: newIndexPath)
}
})
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment