Tuesday, 26 November 2019

Check if you can use unwind segue before using a push segue

In a navigation using segues, from the root controller we can push controller A or B.

From A we can push C which can push B which later can unwind to A to restart the process.

From B we can push A which can push C which later can unwind to B to restart the process.

In B we have button which says "Go to A" which has to unwind or push the controller A depending on the scenario.

diagram

How can I know easily if I can unwind before preforming the push segue?

For now I use the navigationController array to check if the previous controller is C to push or unwind. I would like to know a generic solution for this kind of cycles using segues, for example:

if B can unwind to A then unwind else push A

So, the question is, how can I check B can unwind to A without accessing the navigationController array?



from Check if you can use unwind segue before using a push segue

No comments:

Post a Comment