I am trying to perform smooth animation when hiding and unhiding UI elements in a vertical StackView
. When the UI element has height constraint set, I am unable to obtain expected result. The view does not hide rapidly alongside the animating stackView
.
Below is the button
action
@IBAction
func didSelect(_ sender: UIButton) {
UIView.animate(withDuration: 3) {
self.viewToHide.isHidden.toggle()
}
}
and Storyboard
The green view is expected to update animate along with the animating stackView
. But, it hides after completing the animation and unhides instantly as animation starts when toggled. What am I missing here?