Created
April 24, 2019 13:21
-
-
Save onmyway133/3d6fbc63caa74713c719da2607ede32f to your computer and use it in GitHub Desktop.
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
public extension UIView { | |
func pinCenter(view: UIView) -> [NSLayoutConstraint] { | |
return [ | |
centerXAnchor.constraint(equalTo: view.centerXAnchor), | |
centerYAnchor.constraint(equalTo: view.centerYAnchor) | |
] | |
} | |
func pin(size: CGSize) -> [NSLayoutConstraint] { | |
return [ | |
widthAnchor.constraint(equalToConstant: size.width), | |
heightAnchor.constraint(equalToConstant: size.height) | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment