TinyConstraints
TinyConstraints copied to clipboard
Stack function changes translatesAutoresizingMaskIntoConstraints of superview
Hi there, small problem I've found with this library:
When using the stack(_:axis:width:height:spacing:)
function, it will set translatesAutoresizingMaskIntoConstraints = false
on the superview.
Unless I'm missing something, this is unnecessary and unexpected, and not in line with how the rest of the library works.
Small example how this could go wrong:
let cell = UICollectionViewCell()
let image = UIImageView()
let label = UILabel()
cell.contentView.stack([image, label])
Here, the contentView is managed by UIKit, but will be changed by the stack function. This did in fact break the layout of my UICollectionView.
It's a small issue and the fix is removing one line of code. I get this would be a breaking change and I don't know if it's worth it, but I wanted to share anyway.