I\'m trying to animate a rotation of 180 degrees of a UIImageView
in Swift
UIView.animateWithDuration(1.0, animations: { () -> Void in
90 degrees rotation
var shouldRotateArrow = false {
didSet {
rotateArrow()
}
}
private func rotateArrow() {
let angle: CGFloat = shouldRotateArrow ? .pi / 2 : 0
UIView.animate(withDuration: Constants.arrowRotationDuration) {
self.arrowImageView.transform = CGAffineTransform(rotationAngle: angle)
}
}