Skip to content

Instantly share code, notes, and snippets.

@onmyway133
Created April 24, 2019 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onmyway133/ac61a9abcb8863ec42781e55fee5ce8f to your computer and use it in GitHub Desktop.
Save onmyway133/ac61a9abcb8863ec42781e55fee5ce8f to your computer and use it in GitHub Desktop.
let views = ["box" : box]
let horizontal = "H:|-20-[box]-20-|"
let vertical = "V:|-50-[box(100)]"
let horizontalConstraints = NSLayoutConstraint.constraints(withVisualFormat: horioptions: [], metrics: nil, views: views)
let verticalConstraints = NSLayoutConstraint.constraints(withVisualFormat: veoptions: [], metrics: nil, views: views)
NSLayoutConstraint.activate([horizontalConstraints, verticalConstraints].flatMap({ $0 }))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment