Animate CAShapeLayer path change
I'm trying to animate change of path property of CAShapeLayer like this: animatePathChange(for: progressLayer, toPath: progressPath.cgPath) progressLayer.path = progressPath.cgPath And this is animatePathChange function code: func animatePathChange(for layer: CAShapeLayer, toPath: CGPath) { let animation = CABasicAnimation(keyPath: "path") animation.duration = 1.0 animation.fromValue = layer.path animation.toValue = toPath animation.timingFunction = CAMediaTimingFunction(name: "easeInEaseOut") layer.add(animation, forKey: "path") } But the end result is not what i want. How can i achieve