I solved this using child view controllers. For the first view controller you show, present it in the normal way:
self.presentViewController(myViewController, animated: true, completion: nil)
Once inside that view controller, add a subsequent view controller as a child view controller. You have to manually animate it, but that's a breeze:
addChildViewController(childViewController)
view.addSubview(childViewController.view)
childViewController.view.frame = view.bounds
let startTransform = CGAffineTransformMakeTranslation(0, CGRectGetMaxY(view.bounds))
childViewController.view.transform = startTransform
UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .BeginFromCurrentState, animations: {
childViewController.view.transform = CGAffineTransformIdentity
}, completion: { (_) in
//I wanted to change my status bar color here, do whatever you need
UIApplication.sharedApplication().setStatusBarStyle(.Default, animated: true)
})
Now, if you want to dismiss the entire thing, you just call:
self.dismissViewControllerAnimated(true, completion: nil)
And if you want to dismiss only the childViewController you re-animate the view controller back down and then remove it:
childViewController.view.transform = CGAffineTransformIdentity
UIView.animateWithDuration(0.3, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .BeginFromCurrentState, animations: {
let endTransform = CGAffineTransformMakeTranslation(0, CGRectGetMaxY(self.view.bounds))
childViewController.view.transform = endTransform
}, completion: { (_) in
//remove child view controller
childViewController.removeFromParentViewController()
childViewController.view.removeFromSuperview()
})