iOS17 xcode13 collectionViewContentSize width returns 0 and displays a blank page

In an APP packaged with xcode13 and running on a mobile phone with iOS17 system, the UICollectionView appears blank.

UICollectionView uses a custom UICollectionViewLayout, which overrides the collectionViewContentSize method. The width returned in this method is 0, which will cause cellForItemAtIndexPath not to be called. Setting it to 1 can also display normally.

iOS17 xcode13 collectionViewContentSize width returns 0 and displays a blank page
 
 
Q