As an example, I have baseVC, firstVC and secondVC. BaseVC is the only VC displayed initially, and then upon the user pressing a button in baseVC, they see secondVC presented. When they dismiss secondVC, they see firstVC. When they dismiss firstVC, they see baseVC again.
In other words, I want to present two view controllers at once, one on top of the other. And I want it to animate like displaying a single view controller.
This seems like the initially obvious solution:
//Presents secondVC over firstVC, currently off-screen.
firstVC.presentViewController(secondVC, animated: false, completion: nil)
//Presenting firstVC brings firstVC and secondVC onscreen.
baseVC.presentViewController(firstVC, animated: true) {
() -> Void in
}
Doing this gives me an error:
Warning: Attempt to present on whose view is not in the window hierarchy!
And what I see instead of my result is simply firstVC presented.
How can I achieve this?
EDIT: These should be both displayed modally.