Created
November 18, 2016 17:31
-
-
Save MylesCaley/c5d7ebe83dd5d782a9ba5d4b4108fc16 to your computer and use it in GitHub Desktop.
its possible to create multiple constraints for the same object, then change the priority
This file contains 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
// instead of creating and destroying constraints all the time we can just | |
// add multiple constraints on the same object and then change the priority | |
// and indicate which one is active | |
if feedItem!.prototypeUpdate?.media.count <= 1 { | |
mediaViewWidthConstraintLarge.priority = 995 | |
mediaViewWidthContraint.priority = 999 | |
mediaViewWidthConstraintLarge.isActive = true | |
mediaViewWidthContraint.isActive = false | |
} else { | |
mediaViewWidthConstraintLarge.priority = 999 | |
mediaViewWidthContraint.priority = 995 | |
mediaViewWidthConstraintLarge.isActive = false | |
mediaViewWidthContraint.isActive = true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment