Created
February 17, 2015 20:27
-
-
Save drosenstark/a9c479978fb83f2181a0 to your computer and use it in GitHub Desktop.
Box in Square in Cartography, Autolayout for Swift
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
let percent = 0.3 | |
layout(red, green) { red, green in | |
red.center == red.superview!.center | |
red.size == red.superview!.size | |
green.center == red.superview!.center | |
// lower priority | |
green.width == red.width * percent ~ 100 | |
green.height == red.height * percent ~ 100 | |
green.height == green.width // higher than ~ 100 priority | |
green.width <= red.width * percent | |
green.height <= red.height * percent | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For some reason, the last two lines can be any priority and they work.