In an animation I added a lot of sublayers to a view, with:
[self.view.layer addSublayer:layer1]; [self.view.layer addSublayer:
Simple one liner in SWIFT 4.
self.view.layer.sublayers.removeAll()