Accessing the current position of UIView during animation Accessing the current position of UIView during animation ios ios

Accessing the current position of UIView during animation


You can use the presentationLayer - a property of the CALayer that "provides a close approximation to the version of the layer that is currently being displayed". Just use it like this:

CGRect projectileFrame = [[projectile.layer presentationLayer] frame];


Swift 5: Get temporary position and size (CGRect) during the animation with:

let currentFrame = projectileFrame.layer.presentation()!.frame