When you hide/unhide an element in a UIStackView, it will nicely animate. However when you hide the only element in the stackview, the animation will go wrong. To see what happens, run the following project:
https://github.com/bvankuik/NestedStackViewsShowAndHide
Click the "Toggle Visibility" button. Then tap the "Add dummy view" button and try again.