Adaptive Layout doesn't work with compositional layout of collection view
Zeynal7 opened this issue · comments
Description
When working with FloatingPanelAdaptiveLayoutAnchor
, regular UICollectionViewFlowLayout
works fine, but compositional layout shows nothing. Can someone let me know what kind of a mistake I am doing here? Maybe it is something on my end.
Expected behavior
To adapt to the compositional layout height
Actual behavior
Nothing is shown
Steps to reproduce
Code example that reproduces the issue
CollectionViewFloatingPanel.zip
How do you display panel(s)?
Modally
How many panels do you displays?
1
Environment
Library version
2.8.2
Installation method
- Swift Package Manager
iOS version(s)
17.4
Xcode version
15.3
Thank you for your sample code. I'll try to investigate this issue later.
I confirm collectionView(_:cellForItemAt indexPath:)
delegate method isn't called if the collection view uses a compositional layout. I keep investigating why it happens.
Finally, I've fixed this issue. As a temporary workaround, you can add a heightAnchor to the collection view to resolve the issue.
- collectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor)
+ collectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
+ collectionView.heightAnchor.constraint(greaterThanOrEqualToConstant: 1.0),
Thank you very much