馃毇 If this template is not filled out your issue will be closed with no comment. 馃毇
Info | Value |
-------------------------|-------------------------------------|
Platform | ios
Platform Version | 13.0
SnapKit Version | latest
Integration Method | cocoapods
I trying to create an aspect ratio constraint 1:1. How can I achieve that?
In swift I've done in that way:
extension UIView {
func aspectRatio(_ ratio: CGFloat) -> NSLayoutConstraint {
return NSLayoutConstraint(item: self, attribute: .height, relatedBy: .equal, toItem: self, attribute: .width, multiplier: ratio, constant: 0)
}
}
In snapkit:
view.snp.makeConstraints { (make) in
make.width.equalTo(view.snp.height).multipliedBy(1.0 / 1.0)
}
Most helpful comment
In swift I've done in that way:
In snapkit: