TinyConstraints icon indicating copy to clipboard operation
TinyConstraints copied to clipboard

Stack function changes translatesAutoresizingMaskIntoConstraints of superview

Open OCJvanDijk opened this issue 4 years ago • 0 comments

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.

OCJvanDijk avatar Dec 13 '20 14:12 OCJvanDijk