My app is working before iOS 15.2 version and now crashlytics capture the few crashes which is related to this thread.
Please check the code which I have written:-
static var nib: UINib { return UINib(nibName: String(describing: self), bundle: Bundle(for: Self.self).resource) }
static let identifier = "TableItemCollectionViewCell"
// cell register
override func awakeFromNib() {
super.awakeFromNib()
collectionView.register(TableItemCollectionViewCell.nib,
forCellWithReuseIdentifier: TableItemCollectionViewCell.identifier)
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: TableItemCollectionViewCell.identifier,
for: indexPath) as? TableItemCollectionViewCell,
let cellVM = viewModel.cellViewModel(for: indexPath,
isHorizontalScrollingEnabled: isHorizontalScrollingEnabled, collectionViewWidth: collectionView.frame.size.width) as TableItemCellViewModel?
else {
return collectionView.emptyCell(at: indexPath)
}
// do code here
cell.configure(with: cellVM)
}