pod 'XConstraintKit', :git => '[email protected]:Ajaya1000/XConstraintKit.git', :tag => 'v1'
add this library using this [email protected]:Ajaya1000/XConstraintKit.git
Activate constraint for childView with superView using the function
func activate(with superView: ExpressibleByAnchors? = nil, @XLayoutConstraintBuilder constraints: (XLayoutConstraintMaker) -> [XLayoutConstraint])
self.childView.activate(with: superView) { xc in
xc.leading
xc.trailing
xc.top
xc.bottom
}
ExpressibleByAnchors are conformed by UIView
& UILayoutGuide
for xc.leading => attr1 = .leading, attr1 = .leading for xc.leading.withTrailing => attr1 = .leading, attr1 = .trailing
so on like that
XLayoutConstraint has function to set constant
, priority
and multiplier
.