Swift- How to find width/height of a Presentation Layer that is being scaled and rotated?
<p>So, I have a CALayer that is being rotated and scaled using CABasicAnimation. Since the layer is being rotated, frame returns the frame containing the highest to lowest x and y values(so this will be larger than the actual presented layer). And, while bounds would work if scaling does not occur, the bounds of the layer do not. Here is my code for my custom UIView subclass:</p>

<pre><code>func rotateCircleView(duration: CFTimeInterval = 1.0) {
    let rotateAnimation = CABasicAnimation(keyPath: "transform.rotation")
    rotateAnimation.fromValue = 0.0
    rotateAnimation.toValue = CGFloat(M_PI * 2.0)
    rotateAnimation.duration = duration
    rotateAnimation.repeatCount = Float.infinity

    self.layer.addAnimation(rotateAnimation, forKey: rotateKey)
}



func shrinkCircleView(duration: CFTimeInterval = 1.0, to: Double) {


    let from = self.getCurrentAnimationScale()


    let shrinkAnimation = CABasicAnimation(keyPath: "transform.scale")
    shrinkAnimation.additive = true
    shrinkAnimation.fromValue = from - to
    shrinkAnimation.toValue = 0
    shrinkAnimation.duration = duration
    shrinkAnimation.removedOnCompletion = true


    let scaleTransform = CATransform3DMakeScale(CGFloat(to), CGFloat(to), 1.0)
    layer.transform = scaleTransform


    layer.addAnimation(shrinkAnimation, forKey: "shrinkAnimation")

}


func getCurrentAnimationScale() -&gt; Double{

    if let temp = self.layer.presentationLayer(){
        // return scale of presentationLayer

    } else{
        // return scale of self.layer
    }

}
</code></pre>