Above is my app diagram. I have a root View controller
that present a second view controller
modally. And then the second view controller
will present a view controller
with searchBar
via show segue
.
If users type something in the searchBar
a table view
will show(which has no segue relationship with the view controller in the storyboard) with its cells
populated with all the possible address results. Here if a user tap any prefered cell I would like to perform an unwind segue to go back to second view controller
.
So in override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
I do dismiss(animated: true, completion: nil)
self.performSegue(withIdentifier: "backToNewTasks", sender: self)
But this way the segue will go back one step further to root View controller
not
second view controller
.
I think the problem might be the view controller
with searchBar
has no segue
relationship with the table view
and the dismiss
method has some impact on the views stack
. but if I don't use the dismiss
method the segue
won't even happen.
I have done some research and found these
Programmatically defining a new navigation controller order/stack?
Calling function from another ViewController in swift
Why does my unwind segue go back too far?
But they did not really solve situations like mine.
Below is the link for the sample project:
https://wetransfer.com/downloads/5ee60abbb9c245feab19862b0989b1f120170617090404/dd2235