CABasicAnimation chaining not working
<p>I am having difficulties chaining multiple <code>CABasicAnimation</code>s. I just want to make a button scale to 1.5 times it's size, then to 0.5 and fade away (while scaling down).</p>

<p>The problem is that only the scaling up works then the button goes back to the original state.</p>

<p>I would have used <code>CGAffineTransformMakeScale</code> but it creates a bug in iOS 7. On iOS 8 &amp; 9 it works fine</p>

<p>I tried using a <code>CAAnimationGroup</code> but same result.</p>

<p>Here's the code:</p>

<pre><code>    let scaleUp = CABasicAnimation(keyPath: "transform.scale")
    scaleUp.fromValue = 1
    scaleUp.toValue = 1.5
    scaleUp.duration = 0.2
    scaleUp.beginTime = 0
    scaleUp.removedOnCompletion = true
    self.myButton.layer.addAnimation(scaleUp, forKey: "up")

    let scaleDown = CABasicAnimation(keyPath: "transform.scale")
    scaleDown.fromValue = 1
    scaleDown.toValue = 0.5
    scaleDown.duration = 0.2
    scaleDown.beginTime = scaleUp.beginTime + scaleDown.duration
    scaleDown.removedOnCompletion = true
    self.myButton.layer.addAnimation(scaleDown, forKey: "down")

    let fade = CABasicAnimation(keyPath: "opacity")
    fade.fromValue = 1
    fade.toValue = 0
    fade.duration = 0.2
    fade.beginTime = scaleUp.beginTime + scaleDown.duration
    fade.removedOnCompletion = false
    self.myButton.layer.addAnimation(fade, forKey: "fade")
</code></pre>