Info | Value |
-------------------------|-------------------------------------|
Platform | iOS
Platform Version | iOS 11 (but I think this happens on any version)
SnapKit Version | 4.0.0
Integration Method | cocoapods
I can't set contentCompressionResistanceHorizontalPriority on a view.
self.lblTitle.snp.contentCompressionResistanceHorizontalPriority = UILayoutPriority.defaultLow.rawValue
it says: "Cannot assign to property: 'snp' is a get-only property"
I understand that I can't set it directly but there is no compression property inside the makeConstraints block.
shouldn't it be something like this:
self.lblTitle.snp.makeConstraints { make in
make.contentCompressionResistanceHorizontalPriority.equalTo(UILayoutPriority.defaultLow)
}
Thanks
Giorgi
Just set the priority on the view itself using vanilla UIKit
lblTitle.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
@Rendel27 @rnystrom is correct here, I chose not to re-implement the vanilla functions here. SnapKit also does not have any additional shortcuts for setting layout margins or safe area margins.
Most helpful comment
Just set the priority on the view itself using vanilla UIKit