When using a custom UICollectionViewLayout that makes use of self-sizing cells, it isn't clear to me how to influence the fitting priority sent to the cell's content view via systemLayoutSizeFitting(_:withHorizontalFittingPriority:verticalFittingPriority:) as part of UICollectionViewCell's default implementation of preferredLayoutAttributesFitting(_:).
For example, take a simple self-sizing cell with a basic UIContentView conforming content view that pins a UILabel to each edge using auto-layout:
If I use this cell with a stock list layout (i.e. UICollectionViewCompositionalLayout.list(using: .init(.plain)) ), I can see that when the collection view is laid out, each cell's content view has its systemLayoutSizeFitting(_:withHorizontalFittingPriority:verticalFittingPriority:) method called with the horizontal fitting priority set to .required/1000.
However, when using a custom layout, the fitting priority remains at .fitting/50.
How does UICollectionViewCompositionalLayout achieve this considering the cell is using its default implementation of preferredLayoutAttributesFitting(_:)? Is there a way of specifying the fitting priority from within a layout?
For example, take a simple self-sizing cell with a basic UIContentView conforming content view that pins a UILabel to each edge using auto-layout:
If I use this cell with a stock list layout (i.e. UICollectionViewCompositionalLayout.list(using: .init(.plain)) ), I can see that when the collection view is laid out, each cell's content view has its systemLayoutSizeFitting(_:withHorizontalFittingPriority:verticalFittingPriority:) method called with the horizontal fitting priority set to .required/1000.
However, when using a custom layout, the fitting priority remains at .fitting/50.
How does UICollectionViewCompositionalLayout achieve this considering the cell is using its default implementation of preferredLayoutAttributesFitting(_:)? Is there a way of specifying the fitting priority from within a layout?