This is the setup I'm trying to work with:
As you can see, the structure goes like this:
Navigation Controller > View Controller > Tab Bar Controller > View Controller
I'm trying to pass data through the back button and typically, all I have to do is fire didMove
from the view controller with the back button like this:
override func didMove(toParentViewController parent: UIViewController?) {
if (!(parent?.isEqual(self.parent) ?? false)) {
print("Parent view loaded")
}
}
However, when I place this inside TabItem01ViewController.swift
or TabItem02ViewController.swift
, nothing seems to be fired. If I place the code in TabViewController.swift
, however, didMove
is fired. I can't seem to figure out why it's getting fired from TabViewController.swift
but not either of the tabs views.
So my question is: how do I pass data from either of the tabs to the ViewController.swift
file when the back button is pressed?