Sort:  
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.

  • 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.

Coin Marketplace

STEEM 0.35
TRX 0.12
JST 0.039
BTC 69796.92
ETH 3521.66
USDT 1.00
SBD 4.70