0
votes

With a navigation controller in Swift/Xcode, can I create an unwind segue from a View Controller to the preceding one without creating a custom UIBarButton?

Basically, if I replace the "back" button that's created by default on the navigation item, I could link that to "Exit" and create an unwind segue. However, I wanted to see if there's a way to use the existing "back" button and link a segue identifier to it.

(The one thing I've found out from research which is useful is the default "back" button actually belongs to the preceding View Controller, but this doesn't help me solve me problem.)

2

2 Answers

0
votes

I found an answer here closely related to my question:

Unwind segue with Navigation back button

Unfortunately I didn't find this in my initial research and only stumbled upon it in the "related" section after I posted my question.

0
votes

If you don’t want to insert new UIBarButton then you will most probably end up tracking this event with viewWillDisappear or didMoveToParentViewController method.

Here’s the same question, you might find it helpful:

How to trap the back button event