Guessed it thanks @ Paulw11 ... this solution
view.addConstraint(NSLayoutConstraint(item: gamePreview, attribute: .Trailing, relatedBy: .Equal, toItem: view, attribute: .Trailing, multiplier: 1, constant: 0)) view.addConstraint(NSLayoutConstraint(item: gamePreview, attribute: .Leading, relatedBy: .Equal, toItem: view, attribute: .Leading, multiplier: 1, constant: 0)) view.addConstraint(NSLayoutConstraint(item: gamePreview, attribute: .Top, relatedBy: .Equal, toItem: self.topLayoutGuide, attribute: .Bottom, multiplier: 1, constant: 0)) view.addConstraint(NSLayoutConstraint(item: gamePreview, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute,multiplier: 1, constant: 131))
I also managed to rewrite it as it should, using AutoLayoutDSL-Swift for all interested
view => gamePreview.trailing == view.trailing => gamePreview.leading == view.leading => gamePreview.height == 131 => gamePreview.top == view.top + self.navigationController!.navigationBar.bounds.height + UIApplication.sharedApplication().statusBarFrame.size.height
The last line is a little long because view.top refers to the top of the view and does not take into account the addition added by both the status and the navigationBar height. They could be replaced as constants, waiting if someone came up with a more elegant solution.
source share