Sure. First, I thought that I knew why I was getting the 'force-unwrap' crash following the breakpoints for the crash in that I was using the following: var dataSource: UICollectionViewDiffableDataSource<Section, RandomData>!. So, I changed the code to typealias DataSource = UICollectionViewDiffableDataSource<Section, RandomData>.
I am still getting a "force-unwrap" crash. Here are both methods that I am seeing the respective crash when calling the method from a modal VC. NOTE: The data loads / displays fine on initial load, but crashes when attempting to add new data.
Method #1:
func updateData(for testData: [RandomData]) {
var snapshot = NSDiffableDataSourceSnapshot<Section, RandomData>()
snapshot.appendSections([.main])
snapshot.appendItems(testData)
// Crash on dataSource apply method when calling from anotehr VC.
DispatchQueue.main.async {
self.dataSource.apply(snapshot, animatingDifferences: true, completion: nil)
}}
Method #2
func makeDataSource() -> DataSource {
// Crash on dataSource apply method when calling from anotehr VC.
let dataSource = DataSource(collectionView: collectionView) { (collectionView, indexPath, testData) -> UICollectionViewCell? in
//
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: PerscriptionCell.reuseID, for: indexPath) as? RandomDataCell
cell?.set(dataType: testData)
return cell		}
		return dataSource
		
}
Thank you,
Paul