UIBezierPath cornerRadii value is drawn more than the init value when it is more than 33% of the rectangle's size

I have drawn a rounded rectangle with corner radius by UIBezierPath with init(roundedRect:byRoundingCorners:cornerRadii:)

But I found that when corner radius is more than about 33% of the rectangle's width or height then corner radius are drawn by 50% of rectangle's width or height.

Is this an iOS bug or Did I just do something wrong?

I just want the corner radius is the same with the value when the corner radius is less than 50% of the rectangle's width or height.

Example Code

final class CornerView: UIView {
    override func draw(_ rect: CGRect) {
        let rect = CGRect(x: 100, y: 100, width: 100, height: 100)            
        let roundedPath0 = UIBezierPath(
            roundedRect: rect, 
            byRoundingCorners: [.allCorners], 
            cornerRadii: CGSize(width: 20, height: 20))        
        UIColor.black.setFill()
        roundedPath0.fill()

        let roundedPath1 = UIBezierPath(
            roundedRect: rect, 
            byRoundingCorners: [.allCorners], 
            cornerRadii: CGSize(width: 25, height: 25))        
        UIColor.green.setFill()
        roundedPath1.fill()

        let roundedPath2 = UIBezierPath(
            roundedRect: rect, 
            byRoundingCorners: [.allCorners], 
            cornerRadii: CGSize(width: 30, height: 30))        
        UIColor.blue.setFill()
        roundedPath2.fill()

        let roundedPath3 = UIBezierPath(
            roundedRect: rect, 
            byRoundingCorners: [.allCorners], 
            cornerRadii: CGSize(width: 35, height: 35))        
        UIColor.red.setFill()
        roundedPath3.fill()
    }
}

Result

The red rectangle should be drawn in the same corner radius ratio with the below rectangles.

I'm using

Xcode Version 13.4.1 (13F100)

iOS Simulator: iOS 15.5 iPhone 8 Plus

You're, there is a jump between 32 and 33 (see attached images). 31 and 32 are OK, 33 turn to 50.

Just as if BezierPath was optimizing, guessing that you want a circle (the same if you specified 75. Max seems to be 33%, beyond you get 50% whatever the value.

I also noted it seems to change the color of the red.

Could be worth a bug report, at least request for clarification.

UIBezierPath cornerRadii value is drawn more than the init value when it is more than 33% of the rectangle's size
 
 
Q