Created
February 22, 2018 18:00
-
-
Save mansi-27/76db322acbba5970eb3cd4ea3c69630f to your computer and use it in GitHub Desktop.
Sets rounded corners to the UIView
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
extension UIView { | |
/// Sets rounded corners to the UIView | |
func roundedCorners(radius: CGFloat? = nil) { | |
if let radius = radius { | |
layer.cornerRadius = radius | |
} else { | |
layer.cornerRadius = frame.size.height / 2 | |
} | |
clipsToBounds = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment