Last active
February 13, 2017 14:13
-
-
Save ilandbt/506afea0fdb7b33121bbb9f3c72cdc41 to your computer and use it in GitHub Desktop.
getting height constraint
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
extension UIView { | |
var heightWithConstraint: CGFloat { | |
get { | |
for constraint in constraints where constraint.firstAttribute == .height { | |
return constraint.constant | |
} | |
return 0 | |
} | |
set (newHeight){ | |
for constraint in constraints where constraint.firstAttribute == .height { | |
constraint.constant = newHeight | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment