I want to give cornerRadius to an arc made of UIBezierPath

65 Views Asked by At

I made an arc using the UIBezierPath and I'm going to give it cornerRadius
Here's my code

let shapeLayer = CAShapeLayer()
let path = UIBezierPath(
    arcCenter: CGPoint(x: rect.midX, y: rect.maxY),
    radius: rect.midX - 16 - 20,
    startAngle: .pi,
    endAngle: 2 * .pi,
    clockwise: true
    )
shapeLayer.path = path.cgPath

shapeLayer.strokeColor = UIColor.yellow.cgColor
shapeLayer.lineWidth = 40
shapeLayer.fillColor = UIColor.clear.cgColor
shapeLayer.lineCap = .round

layer.addSublayer(shapeLayer)

result
This is my result
cornerRadius was applied throughout the lineWidth
But what I want is to apply about 5 on the corner
What shoud I do?
what i want

0

There are 0 best solutions below