12

I was using NSFetchedResultsController for core data .

And on implementing controllerWillChangeContent() method.

        self.collectionView.beginUpdates()

shows error from Xcode 8 , swift 3 .

Any suggestion.

user3804063
  • 809
  • 1
  • 14
  • 32

1 Answers1

26

beginUpdates is from UITableView. UICollectionView has the performBatchUpdates(_:completion:) method.

I suggest reviewing this answer for information on using NSFetchedResultsController and UICollectionView.

Community
  • 1
  • 1
rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • 2
    I had used like this self.collectionView.performBatchUpdates({ self.collectionView?.insertItems(at: [newIndexPath]) }, completion: { (result) in self.scrollToBottom(animated: true) //private method for scroll up. }) Thanks for help – Ravi Kumar Jun 24 '18 at 09:21
  • thanks to @rmaddy for the explanation and link to that amazing QA ! – Fattie Feb 03 '20 at 16:53