My goal is to present a view controller without dismissing directly to its presentingViewController
.
To make it more clear, consider the following example:
Referring to this storyboard:
Assuming that the first black view controller is the first (initial) one, it should present the third white view controller; The issue is the white view controller should dismisses to the second orange view controller but not the black one, so it should behave like:
How to apply such a behavior?
Remark: There is no navigation controller, it should be present/dismiss, not push/pop.
This could be achieved by letting the first black view controller to present the second orange view controller and then the orange view controller should present the third white view controller.
But this arises an issue which is: the end-user will clearly notice that there are two view controllers have been sequentially presented. For solving this, you will need to do a pretty simple trick which is to take a screenshot from the first view controller and passing it to the second view controller to display it while presenting the third view controller.
You can check this repository to see how it is exactly could be done (Swift 3).
The final output would be:
Here is one method...
viewDidLoad
, Orange instantiates White as a childVC and adds White's view as a 'full-screen' subview.Here is method two...
.setViewControllers:animated:
to "stack the views" on the navigation controller, and jump directly to the last view..popViewController
functionality.You can view a working example of both methods here: https://github.com/DonMag/SkipNavigation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With