-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Hi QuickLayout team,
First of all, thank you for open-sourcing QuickLayout.
We’ve been using it successfully in a UIKit project and really like the declarative layout style and performance benefits.
We are currently using QuickLayout inside UICollectionViewCell with UICollectionViewCompositionalLayout, where:
• Cell width is fixed (fractionalWidth = 1.0)
• Cell height is dynamic and content-driven
• Layout uses .estimated(...) height
To make auto-sizing work, we currently need to override
preferredLayoutAttributesFitting(:) in every custom cell and call sizeThatFits(), for example:
override func preferredLayoutAttributesFitting(
_ layoutAttributes: UICollectionViewLayoutAttributes
) -> UICollectionViewLayoutAttributes {
var attrs = layoutAttributes
let targetSize = CGSize(
width: layoutAttributes.size.width,
height: .greatestFiniteMagnitude
)
let size = sizeThatFits(targetSize)
attrs.size.height = ceil(size.height)
return attrs
}
This works well, but it becomes repetitive when many different cells use QuickLayout.
Question
Is there a recommended or built-in approach to:
• Avoid overriding preferredLayoutAttributesFitting(_:) in every cell?
• Or provide a shared / automatic integration for auto-sizing cells when using UICollectionViewCompositionalLayout?
For example:
• A base UICollectionViewCell provided by QuickLayout
• A protocol or helper API
• Or a way for @quicklayout to hook into the sizing lifecycle automatically
We understand this might be a UIKit limitation, but wanted to ask if there is an officially recommended pattern or future plan for this use case.
Thanks again for the great library!