A lot of the other answers reference atan2f
, but given that we're operating on CGFloat
s, we can just use atan2
and skip the unnecessary intermediate cast:
Swift 4:
let radians = atan2(yourView.transform.b, yourView.transform.a)
let degrees = radians * 180 / .pi