Ofcourse it's a matter of choice, but you'll need to import that class everytime, you need to keep up with updates. I'm not sure if it's efficiently work on phone rotations. And by you mean lesser code you'll need to memorize.
setLeadingSpaceFromSuperView
setTrailingSpaceFromSuperView
setTopSpaceFromSuperView
pinHeightConstraint
centerHorizontallyWithView
setVerticalSpaceFrom
And if you start to work with others they'll suffer from it IMO.
You just have to drag the class into the project and no need to import the class everytime as swift classes are globally available throughout the project, In swift, you only import module eg. UIKit. This class also has full support for rotation as well. Hope it helps.
redView.prepareForNewConstraints { (v) in v?.setLeadingSpaceFromSuperView(leadingSpace: 50) v?.setTrailingSpaceFromSuperView(trailingSpace: -50) v?.setTopSpaceFromSuperView(topSpace: 50) v?.pinHeightConstraint(constant: 200)
NSLayoutConstraint.constraintsWithVisualFormat("V:|-50-[v1(200)]", options: [], metrics: nil, v1: "redView") NSLayoutConstraint.constraintsWithVisualFormat("H:|-50-[v1]-50-|", options: [], metrics: nil, v1: "redView")
Ofcourse it's a matter of choice, but you'll need to import that class everytime, you need to keep up with updates. I'm not sure if it's efficiently work on phone rotations. And by you mean lesser code you'll need to memorize.
And if you start to work with others they'll suffer from it IMO.
You just have to drag the class into the project and no need to import the class everytime as swift classes are globally available throughout the project, In swift, you only import module eg. UIKit. This class also has full support for rotation as well. Hope it helps.