Snippets Collections
override func layoutSubviews() {
    super.layoutSubviews()
    roundCorners(corners: [.topLeft, .topRight], radius: 3.0)
}

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
    }
}
star

Mon Feb 07 2022 07:41:03 GMT+0000 (Coordinated Universal Time)

#ios #swift #round #corner #view #viewround

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension