Calling CALayer.presentationLayer will trigger the method “initWithLayer” automatically, so, make sure you overwrite that init method and do some thing necessary.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
- (instancetype)initWithLayer:(id)layer {
self = [super initWithLayer: layer];
if (self == nil) {
return nil;
}
MLog(@"[CMCircleLayer] --> initWithLayer");
/***************************
* Do some thing necessary
**************************/
return self;
}

Another trick for free, set a fast speed to main window’s layer can ignore all animations on auto test.

1
2
// After app launched
self.window.layer.speed = 100;

Write the code. Change the world.