Post

Replies

Boosts

Views

Activity

Reply to How to: Compositional layout with self-sizing rows of N columns where the height of each item is set to the tallest item in its row
I've resolved this situation for grids by subclassing UICollectionViewCompositionalLayout and modifying attributes received from super in layoutAttributesForElements(in:). Here I take attributes with same frame.origin.y and apply frame.size.height of the talles among them. Be sure you take attributes where attributes.representedElementCategory == .cell. Some extra logic may be required, but it works for grid and introduces issues for orthogonal sections. So I've also added per-section check if I need to modify items in this specific indexPath.section.
Apr ’23