Created
January 31, 2019 13:41
-
-
Save shakemno/edaba2d514384df0a373f83bf478d965 to your computer and use it in GitHub Desktop.
Get a constraint by identifier - without the need of using a property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // add .identifier | |
| let centerXConstraint = view.centerXAnchor.constraint(equalTo: centerXAnchor, constant: 0) | |
| centerXConstraint.identifier = "IdentifierName" | |
| // get constraint | |
| let constraintByIdentifier = view.constraints.filter ({ $0.identifier == "IdentifierName" }).first |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment