Basic animation flow about Frame or Constraint animation way.
Do basic animate using to Frame modification,
modify frame in animation closure simply.
UIView.animate(withDuration: 1, animations: {
self.view.frame.size.height = 100
})
Do basic animate using to Constraint modification,
the key of animating using constraints is “layoutIfNeeded”.
// modify
if let heightConstraint = view.constraints.first(where: {$0.firstAttribute == .height}) {
heightConstraint.constant = 100
}
// animate
UIView.animate(withDuration: 5, animations: {
self.view.layoutIfNeeded()
})