Diffable DataSource / Snapshot crash when updating


I am able to statically load data and have it display in a CollectionView Diffable / Snapshot view without any problems. But I am getting the following crash ‘Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value’ when attempting to update the data from another viewController.

I am using a shared instance pass data between the viewControllers, and I can use a print statement to see that the data is getting appended. I also tried to update the data on the main queue, but I still got the same error.

Here’s the code that I am using, and would appreciate any help.

func update(data: [Data]) {
var snapshot = NSDiffableDataSourceSnapshot<Section, Data>()

    self.dataSource.apply(snapshot, animatingDifferences: true, completion: nil)


@pdl5000 Do you still have issues with this?

This topic was automatically closed after 166 days. New replies are no longer allowed.