I want to change the rootViewController of the keyWindow, to do that I need to dismiss all presented view controllers (or a whole stack of presented view controllers).
I currently use this in AppDelegate,
[[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:NO completion:^{
UIWindow *window = self.window;
window.rootViewController = [self makeAnotherVCAsRoot];
}];
I wrote about presentingViewController, so in this case, I'm just lucky as the old rootViewController is the presentingViewController, as no view controllers have defined definesPresentationContext
I personally think that we should find the presented view controller stack, and dismiss it, instead of using rootViewController