CAKeyframeAnimation *keyFrame = [CAKeyframeAnimation animationWithKeyPath:@"position.x"];
keyFrame.duration = 0.3;
CGFloat x = self.layer.position.x;
keyFrame.values = @[@(x - 30), @(x - 30), @(x + 20), @(x - 20), @(x + 10), @(x - 10), @(x + 5), @(x - 5)];
[self.layer addAnimation:keyFrame forKey:@"shake"];
keyFrame.duration = 0.3;
CGFloat x = self.layer.position.x;
keyFrame.values = @[@(x - 30), @(x - 30), @(x + 20), @(x - 20), @(x + 10), @(x - 10), @(x + 5), @(x - 5)];
[self.layer addAnimation:keyFrame forKey:@"shake"];