Is "vc1" and "vc2" meant to match the class of the viewControllers in the project?
I just used the info you gave in OP:
I have a collection view in VC1 embedded in a navigationController. The collection view contains buttons that go to VC2.
so vc1 is the instance of VC1 and vc2 instance of VC2
This is in viewWillDisappear of VC2. Exact ?
Then, you could write (I adjusted for optionals):
func viewWillDisappear() {
if let vcs = self.navigationController?.viewControllers {
let vc1 = vcs[0] // may need to write if let vc1 = vcs[0] as? VC1 { vc1.functionToUpdate }
vc1.functionToUpdate
}
}
The navigation controller starts after the Home Screen, btw, I didn't mention that before. I have three navigation controllers branching off from the initial VC, is this bad practice or normal in IOS development?
initial VC is Home screen ?
How do you go from there to each navigation stack ?
I see nothing wrong there, as long as user can understand where he/she is navigating to.
For the code above to work, what is key is to have the following sequence (in IB):
Home Screen NavigationController VC1 VC2
That would also work with a pattern as
Home Screen NavigationController VC1 VC1bis VC1ter VC2