I want my UIView round from top right and top left only
view.layer.cornerRadius = 10
I want my UIView round from top right and top left only
view.layer.cornerRadius = 10
Extension of UIView
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
}
}
call function for your view
topView.roundCorners(corners: [.topLeft,.topRight], radius: 8)