Вот тестовый код, вы можете скопировать и протестировать:
override func viewDidLoad() {
super.viewDidLoad()
let blueView = UIView(frame: .init(x: 20, y: 100, width: 100, height: 40))
blueView.backgroundColor = .blue
view.addSubview(blueView)
let blueViewPath = UIBezierPath.init(roundedRect: blueView.bounds, byRoundingCorners: [.bottomLeft, .bottomRight], cornerRadii: .init(width: 20, height: 20))
let blueViewLayer = CAShapeLayer()
blueViewLayer.frame = blueView.bounds
blueViewLayer.path = blueViewPath.cgPath
blueView.layer.mask = blueViewLayer
let orangeView = UIView(frame: .init(x: 20, y: 150, width: 100, height: 40))
orangeView.backgroundColor = .orange
view.addSubview(orangeView)
let orangeViewPath = UIBezierPath.init(roundedRect: orangeView.bounds, byRoundingCorners: [.bottomLeft, .bottomRight], cornerRadii: .init(width: 40, height: 40))
let orangeViewLayer = CAShapeLayer()
orangeViewLayer.frame = orangeView.bounds
orangeViewLayer.path = orangeViewPath.cgPath
orangeView.layer.mask = orangeViewLayer
}
результат
Высота blueView и orangeView равна 40, радиус blueView равен 20, радиус OrangeView равен 40.
Но, как вы видите, радиус OrangeView выглядит как 20.
Зачем? Как решить?