In an animation I added a lot of sublayers to a view, with:
[self.view.layer addSublayer:layer1]; [self.view.layer addSublayer:
For swift5 to remove CAShapeLayer from added view
for layer in self.view.layer.sublayers! { if layer.isKind(of: CAShapeLayer.self) { layer.removeFromSuperlayer() } }