NSCollectionLayoutSection.visibleItemsInvalidationHandler returning wrong visible items

Originator:hotngui
Number:rdar://FB8834530 Date Originated:10/29/2020
Status:Open Resolved:
Product:UIKit Product Version:iOS 13
Classification:Bug Reproducible:Always
 
I am trying to use the new iOS 13 class, UICollectionViewCompositionalLayout but am not able to get meaning information from the NSCollectionLayoutSection.visibleItemsInvalidationHandler. In the simple example (see code, see movie file) I keep getting output like the following when I swipe to the next cell. I do not know why cell 0:0 shows up constantly even though I am toward the middle or end of my cells in the collection view.

item: 0:0
item: 2:0
item: 3:0
 
item: 0:0
item: 3:0
 
Background: My collectionView is setup such that a cell takes the entire screen. As the user swipes through the cells I need to know the "current" visible cell. However, since cell 0:0 always shows up in the array of visible items I cannot do what I need to do. Ultimately, I am trying to workaround an issue where when the user rotates the device the scrolling is incorrect and I see half of two separate cells - which is wrong since I am paging.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!