Is this the proper order of commands to dismiss a UIView?

I've learned the hard way that specific commands to add a child UIView must be in a certain order, especially if I am bringing in the child UIView using animation.

So I'd like to be clear that what the order I use to delete a child UIView is correct. Yes, what I have below works. But that doesn't mean it's correct.

Thank you

UIView.transition(with: parent, duration: 0.5, options: .transitionCurlUp, animations: { [self] in
                    self.willMove(toParent: nil);
                    self.removeFromParent();
                    self.view.removeFromSuperview();
                    self.dismiss(animated: false, completion: nil);
        }, completion:nil)

When reading doc, it seems you do it in the proper order. But if I may ask: why do you need to add childView instead of subview ? Is the view so complex that it needs its own controller ?

Is this the proper order of commands to dismiss a UIView?
 
 
Q