Collectionview Flowlayout estimated size issue for iOS 15 and above

Hi all, I have my code that supports from ios 13 and latest. I used collectionview to display various scenarios and it is working with cell self sizing approach.

And code is working fine upto ios 14.x version but it has an crash issue for iOS 15.x and what I found if I comment out the code for " layout.estimatedItemSize = UICollectionViewFlowLayout.automaticSize" then it doesn’t crash but still not have proper UI for it.

Here is crash logs : I didn’t understand what the reason?

 [UICollectionViewRecursion] UICollectionView 0x7ff17d09e000 Visible cells update scheduled with call stack:  ( 0  UIKitCore              0x00007fff2469dfc5 -[UICollectionView _setNeedsVisibleCellsUpdate:withLayoutAttributes:] + 107 1  UIKitCore              0x00007fff246cf820 -[UICollectionView _invalidateLayoutWithContext:] + 1310 2  UIKitCore              0x00007fff24700ad0 -[UICollectionViewLayout invalidateLayoutWithContext:] + 200 3  UIKitCore              0x00007fff246f47ed -[UICollectionViewFlowLayout invalidateLayoutWithContext:] + 667 4  UIKitCore              0x00007fff246fe023 -[UICollectionViewFlowLayout _didPerformUpdateVisibleCellsPassWithLayoutOffset:] + 430 5  UIKitCore              0x00007fff246ad6a9 -[UICollectionView _updateVisibleCellsNow:] + 11242 6  UIKitCore              0x00007fff246ad770 -[UICollectionView _updateVisibleCellsNow:] + 11441 7  UIKitCore              0x00007fff246ad770 -[UICollectionView _updateVisibleCellsNow:] + 11441 8  UIKitCore              0x00007fff246ad770 -[UICollectionView _updateVisibleCellsNow:] + 11441 9  UIKitCore              0x00007fff246ad770 -[UICollectionView _updateVisibleCellsNow:] + 11441 10 UIKitCore              0x00007fff246ad770 -[UICollectionView _updateVisibleCellsNow:] + 11441 11 UIKitCore              0x00007fff246ad770 -[UICollectionView _updateVisibleCellsNow:] + 11441 12 UIKitCore              0x00007fff246ad770 -[UICollectionView _updateVisibleCellsNow:] + 11441

and so on

Collectionview Flowlayout estimated size issue for iOS 15 and above
 
 
Q