How to render CALayer to UIImage with a Core Animation applied?

I have a CALayer with many sublayers. Those sublayers have multiple CABasicAnimation added to them.

Now, I'd like to render the whole layer subtree to the UIImage at a specific point of animation time. How could I achieve that?

The only thing I found is a CALayer.render(in:) method but the docs say that this method ignores Core Animations :<

How to render CALayer to UIImage with a Core Animation applied?
 
 
Q