My code worked for iOS 14.x with Xcode 12.5.x. Updating to Xcode 13.x with iOS 15, I am receiving the following crash (in AppDelegate
) anytime I attempt to open the quiz view:
Thread 1: “Attempted to scroll the collection view to an out-of-bounds item (0) when there are only 0 items in section 0. Collection view: <UICollectionView: 0x7f94b5872e00; frame = (15 100; 384 627); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x6000031d4570>; layer = <CALayer: 0x600003eed780>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; layout: <UICollectionViewFlowLayout: 0x7f94b4b22160>; dataSource: <QuizViewController: 0x7f94b51c6800>>.”
Note that the issue is not in Xcode, because I tested the code using an emulator device with iOS 14.x installed and everything was working, the issue is in iOS 15.x itself
My QuizViewController
class:
Github | QuizViewController.swift
Is this an expected change or something that needs to be addressed?