Can I pin my view to my superView's edge instead of its layout margin through VFL? Can I be even flexible to toggle "Relative to margin" on myView as well?
NO VFL (this is what I want to achieve with Visual Format Language):
var constraintLeft = NSLayoutConstraint(item: myView, attribute: NSLayoutAttribute.Left, relatedBy: NSLayoutRelation.Equal, toItem: self.view!, attribute: NSLayoutAttribute.Left, multiplier: 1.0, constant: 0)
var constraintRight = NSLayoutConstraint(item: myView!, attribute: NSLayoutAttribute.Right, relatedBy: NSLayoutRelation.Equal, toItem: self.view!, attribute: NSLayoutAttribute.Right, multiplier: 1.0, constant: 0)
VFL :
var constraintHorizontal = NSLayoutConstraint.constraintsWithVisualFormat("H:|-[myView]-|", options: NSLayoutFormatOptions(0),metrics: nil, views: viewsDictionary)
You can use
"H:|[myView]|"
instead of"H:|-[myView]-|"
to constrain to the edge.