Skip to content

Instantly share code, notes, and snippets.

@dimkagithub
Created November 2, 2021 05:53
Show Gist options
  • Save dimkagithub/1ddae807f4e37463b1db15675a43e785 to your computer and use it in GitHub Desktop.
Save dimkagithub/1ddae807f4e37463b1db15675a43e785 to your computer and use it in GitHub Desktop.
UIView Extension
extension UIView {
func roundCorners(corners: UIRectCorner, radius: CGFloat) {
let path = UIBezierPath(roundedRect: bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
layer.mask = mask
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment