Skip to content

Instantly share code, notes, and snippets.

@wh1pch81n
Last active December 28, 2016 20:34
Show Gist options
  • Save wh1pch81n/f48fc764e556dee3f99362f16fd957bb to your computer and use it in GitHub Desktop.
Save wh1pch81n/f48fc764e556dee3f99362f16fd957bb to your computer and use it in GitHub Desktop.
// Adding a vertical constraint between view1 and view2 using default padding
// DHConstraintBuilder
parentView.addConstraints(view1 ^-^ view2).V
// NSLayoutConstraints
parentView.translatesAutoresizingMaskIntoConstraints = false
parentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:[view1]-[view2]"
, options: NSLayoutFormatOptions(rawValue: 0)
, metrics: nil, views: ["view1": view1, "view2": view2]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment