I'm trying to get the angle of rotation of a UIView while it is being animated. I figured out that such properties are available / up to date during animation in the layer.presentation(). I'm trying to extract from there the angle of rotation, however, the transform property here is actually a CATransform3D and not the simple CGAffineTransform that I am used to working with. Is there a simple way to get the rotation angle from the CATransform3D or a way to convert to CGAffineTransform?
SOME EXAMPLE CODE
let someView = UIView()
UIView.animate(withDuration: 1.0) {
someView.transform = //...
}
// Called by user interaction / timer
func getTransformNow() {
if let transform = someView.layer.presentation().transform {
// Need rotation angle here
}
}