Fix unsatisfiable constraints warning for ZeroHeightCollectionViewCell

This commit is contained in:
Shadowfacts 2022-12-04 12:17:31 -05:00
parent e3e55de55b
commit df07fa85d5
1 changed files with 6 additions and 1 deletions

View File

@ -12,7 +12,12 @@ class ZeroHeightCollectionViewCell: UICollectionViewCell {
override init(frame: CGRect) {
super.init(frame: frame)
heightAnchor.constraint(equalToConstant: 0).isActive = true
// sometimes the collection view imposes a height constraint initially
// (though the zero height one still takes effect later)
// and we want to suppress the unsatisfiable constraints warning
let constraint = heightAnchor.constraint(equalToConstant: 0)
constraint.priority = .init(999)
constraint.isActive = true
}
required init?(coder: NSCoder) {