Last active
September 23, 2020 08:56
-
-
Save martinnormark/bc576e7938a3449360f0 to your computer and use it in GitHub Desktop.
Example of updateConstraints using PureLayout
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
private var didUpdateConstraints: Bool = false | |
override func updateConstraints() { | |
if (!didUpdateConstraints) { | |
self.buildStatusIndicatorView.autoPinEdgesToSuperviewEdgesWithInsets(UIEdgeInsetsZero, excludingEdge: ALEdge.Trailing) | |
self.buildStatusIndicatorView.autoSetDimension(ALDimension.Width, toSize: 10) | |
self.buildNumberLabel.autoPinEdgesToSuperviewEdgesWithInsets(UIEdgeInsets(top: 5, left: 15, bottom: 5, right: 5), excludingEdge: ALEdge.Bottom) | |
self.buildNumberLabel.autoSetDimension(ALDimension.Height, toSize: 23) | |
self.branchLabel.autoPinEdge(ALEdge.Top, toEdge: ALEdge.Top, ofView: self.contentView, withOffset: 10) | |
self.branchLabel.autoPinEdge(ALEdge.Trailing, toEdge: ALEdge.Trailing, ofView: self.contentView, withOffset: -10) | |
self.commitMessageLabel.autoPinEdge(ALEdge.Top, toEdge: ALEdge.Bottom, ofView: self.buildNumberLabel, withOffset: 10) | |
self.commitMessageLabel.autoPinEdgeToSuperviewEdge(ALEdge.Leading, withInset: 15) | |
self.commitMessageLabel.autoPinEdgeToSuperviewEdge(ALEdge.Bottom, withInset: 5) | |
self.commitMessageLabel.autoConstrainAttribute(ALAttribute.Width, toAttribute: ALAttribute.Width, ofView: self.contentView, withOffset: -20) | |
didUpdateConstraints = true | |
} | |
super.updateConstraints() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I used to do the same thing