I am stumped on this. Here is my scenario. In my Appdelegate, I am creating
In my case, numberOfItemsInSection
was being called twice from self.performBatchUpdates
(once for the BEFORE number, once for the AFTER number) because I was trying to insert something into the collectionView before the view controller had finished loading.
The solution is to add guard isViewLoaded else { return }
before calling self.performBatchUpdates
.