Collection view cells disappearing when keyboard appears under iOS 16

I have a UICollectionView where sometimes (about 50% of the time) when the keyboard appears, it causes all of the collection view cells to disappear. This only happens on iOS 16, and the collection view itself maintains its size throughout the keyboard presentation and dismissal, but loses all of its cells. The didEndDisplaying UICollectionViewDelegate method is called for each of the cells that were being displayed.

I've tried using both diffable data source and UICollectionViewDataSource implementations. I've tried using keyboard notifications to move the collection view up, and I've tried pinning the bottom of the collection view to the top of the keyboard layout guide. The issue persists no matter the implementation.

Given that it works on iOS 15 just fine, and that the issue is non-deterministically happening about half the time on iOS 16, I'm inclined to think it's yet another iOS 16 bug. I've debugged thoroughly, reviewed my code over and over, tried different implementations, and made all kinds of arbitrary changes and removals to the surrounding code to try and identify a cause but I cannot.

Is anyone else experiencing this? For what reasons would the cells disappear from a collection view? I know a change in data source or snapshot would do it but neither of those are occurring. I'm not sure what other things could cause all cells to disappear. I apologize that I cannot share code but it's a very simple collection view implementation and grid layout, and I'm quite confident that there is no obvious flaw in my code and that the issue is something obscure or out of my control.

same situation here. on I'm on 16.1 now and it's happening systematically. In my case, it's occurring after a network call which triggers the collectionView to reloadData. If I comment out the collectionView.reloadData(), the cells appear properly.

Did you end up finding a fix for this?

My case doesn't involve keyboard interaction but shares same roots, I think. Regular collection view, flow layout, heavily relies on willDisplayCell, cellForIndexPath and didEndDisplaying methods for adding custom content to cells. When collections' layout bounds changes, didEndDisplaying is called for some cells that are actually on-screen inside visible rect (missing accompanying calls to willDisplayCell & cellForIndexPath).

Collection view cells disappearing when keyboard appears under iOS 16
 
 
Q