In an animation I added a lot of sublayers to a view, with:
[self.view.layer addSublayer:layer1]; [self.view.layer addSublayer:
Swift 4.1
self.view.layer.sublayers?.removeAll()
or if in a UIView sub-class just
layer.sublayers?.removeAll()