Incorrect position of CAShapeLayer
I have a UIView called viewProgress . It is the white box in the image. I want a circular progress bar, which is the green circle in the image. The progress bar should stay within the white box, but as you can see it is way off. How do I make it stay inside the viewProgress ? Here you have my animation function: func animateView() { let circle = viewProgress // viewProgress is a UIView var progressCircle = CAShapeLayer() let circlePath = UIBezierPath(arcCenter: circle.center, radius: circle.bounds.midX, startAngle: -CGFloat(M_PI_2), endAngle: CGFloat(3.0 * M_PI_2), clockwise: true)