Issue #422
To constrain views outside to elements inside UICollectionViewCell
, we can use UILayoutGuide
.
Need to make layout guide the same constraints as the real elements
let imageViewGuide = UILayoutGuide()
collectionView.addLayoutGuide(imageViewGuide)
NSLayoutConstraint.on([
imageViewGuide.topAnchor.constraint(equalTo: collectionView.topAnchor, constant: 16),
imageViewGuide.heightAnchor.constraint(equalTo: collectionView.heightAnchor, multiplier: 0.5)
])
NSLayoutConstraint.on([
loadingIndicator.centerXAnchor.constraint(equalTo: collectionView.centerXAnchor),
loadingIndicator.centerYAnchor.constraint(equalTo: imageViewGuide.centerYAnchor)
])