Flipacholas Flipacholas - 6 months ago 77
Swift Question

Communication between navigation controller and container view

Parent
View Controller
_________________
| |
| |
| | Navigation Cont.
|_________________| _________________
| | | |
| | | |
| Container View | --> | | --> Child View Controllers
| | | |
|_________________| |_________________|


My app has a navigation structure composed by a parent view controller and a container that contains a navigation controller (and its child view controllers). The problems is that during the initialisation of these child View Controllers I want to pass some values provided by the Parent View controller. Unfortunately the method
prepareForSegue
used in the parent only detects the container segue but its not called when the child view controllers are changing.

How could this problem be addressed? I'm using Swift but I also understand Objective-C.

Answer

Well, at the end it took time... but I finally got it. It's simple: the child will talk with the parent over self.parentview.parentview. A couple of delegates and it's done.