Daily iOS
UIKit

Constraint animation

This Auto Layout code is meant to slide a panel up, but the panel jumps into place with no animation. Why?

bottomConstraint.constant = -300
view.layoutIfNeeded()
UIView.animate(withDuration: 0.3) {
    self.view.layoutIfNeeded()
}

Pick one

Submit