swiftui corner radius code example
Example 1: add corner radius to uiview swift
view.layer.cornerRadius = 25
view.layer.masksToBounds = true
Example 2: how to add corner in swiftui
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
}
}