I was just knew that the completion block in the self.presentViewController(childVc, animated: true, completion: {})
is called after the child view controller is finish getting animated to be displayed at the screen. I actually want to run a block of code that get displayed after the animation of child view controller is finished getting animated to be dismissed. How can I do that, preferrably avoiding using delegate to do that?
EDIT: I call this from the presented (child) view controller like this: self.presentingViewController.dismissViewControllerAnimated (true) {}
, but the problem is the child view controller can be presented from arbitrary page, and after the child is dismissed, the parent (presenting) view controller has to do different things. If I implement the call back in the child, I can't do different thing with different parent that call it.
For example, if I call login form as modal in the news screen, after the login form dismissed, I want to display comment section afterwards. But if the login form modally displayed from product screen, I want to display the user's cart with the product in the cart afterwards. If this is impossible to be done without delegate, I still interested in the delegate solution.