Animate view on updating constraint values


Add following method inside your view controller.

func animateListView() {
  view.setNeedsUpdateConstraints()
  UIView.animate(withDuration: 0.25, animations: {
    self.view.layoutIfNeeded()
  }, completion: nil)
}

After updating constraint value, invoke above method.