Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save StuartMorris0/8fa1102d2c7770fc66f6 to your computer and use it in GitHub Desktop.
Save StuartMorris0/8fa1102d2c7770fc66f6 to your computer and use it in GitHub Desktop.
Get reference to a constraint by filtering through all constraints looking for a specific identifier in Swift
let foregroundTopConstraint = self.contentView.constraints.filter{ $0.identifier == "ForegroundViewTop"}.first
@dimpiax
Copy link

dimpiax commented May 1, 2018

view.constraints.first { $0.identifier == "name" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment