Using Autolayout Visual Format with Swift?

this works for me with no error:

let bar:[AnyObject]! = NSLayoutConstraint.constraintsWithVisualFormat(
  nil, options: NSLayoutFormatOptions(0), metrics: nil, views: nil)

update

the line above may not be compiled since the 1st and 4th parameters cannot be optionals anymore.

syntactically those have to be set, like e.g. this:

let bar:[AnyObject] = NSLayoutConstraint.constraintsWithVisualFormat("", options: NSLayoutFormatOptions(0), metrics: nil, views: ["": self.view])

update

(for Xcode 7, Swift 2.0)

the valid syntax now requests the parameters’s name as well, like:

NSLayoutFormatOptions(rawValue: 0)

NOTE: this line of code shows the correct syntax only, the parameters itself won’t guarantee the constraint will be correct or even valid!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)