Created
September 26, 2020 16:06
-
-
Save yabenatti/8e1c7fc59184be358b58ddbdaf35beb5 to your computer and use it in GitHub Desktop.
Cartography Constraints
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
import Cartography | |
private func setupWithCartography() { | |
view.addSubview(titleLabel) | |
view.addSubview(hiButton) | |
constrain(titleLabel, view) { label, superview in | |
label.top == superview.top + 20 | |
label.leading == superview.leading + 20 | |
label.trailing == superview.trailing - 20 | |
} | |
constrain(hiButton, titleLabel, view) { button, label, superview in | |
button.top == label.bottom + 8 | |
button.leading == superview.leading + 20 | |
button.trailing == superview.trailing - 20 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment