I\'m coming from as AS3 background so it might be easier for me to show you what I\'m trying to do with AS3. I have a UIViewController(root) and inside that I have a ContainerV
Well or you can use static variables, which is probably the most straightforward way.
class ParentViewController: UIViewController {
static var instance:ParentViewController?
override func awakeFromNib() {
self.dynamicType.instance = self
}
func parentFunction() {
print("called \(#function) in \(self.dynamicType)")
}
}
class ChildViewController: UIViewController {
func childFunction() {
ParentViewController.instance?.parentFunction()
}
override func viewDidAppear(_ animated: Bool) {
childFunction()
}
}