Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive Layout doesn't work with compositional layout of collection view #628

Closed
Zeynal7 opened this issue May 7, 2024 · 4 comments · Fixed by #634
Closed

Adaptive Layout doesn't work with compositional layout of collection view #628

Zeynal7 opened this issue May 7, 2024 · 4 comments · Fixed by #634

Comments

@Zeynal7
Copy link

Zeynal7 commented May 7, 2024

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

@scenee
Copy link
Owner

scenee commented May 11, 2024

Thank you for your sample code. I'll try to investigate this issue later.

@scenee
Copy link
Owner

scenee commented May 25, 2024

I confirm collectionView(_:cellForItemAt indexPath:) delegate method isn't called if the collection view uses a compositional layout. I keep investigating why it happens.

@scenee
Copy link
Owner

scenee commented May 25, 2024

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),

scenee added a commit that referenced this issue May 25, 2024
@Zeynal7
Copy link
Author

Zeynal7 commented May 30, 2024

Thank you very much

@Zeynal7 Zeynal7 closed this as completed May 30, 2024
scenee added a commit that referenced this issue Jun 8, 2024
* Fix #628 
* Add a new sample to test UICollectionView using a compositional layout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants