I have a situation: I have a SideMenu and there is a Logout button on it. After the logout is triggered, 2 things are to be done:
try Auth.auth().signOut()is to be done in Firebaseself.navigationController?.dismiss(animated: true, completion: nil)is to be triggered
On the screenshot below (I will add description for those, who cannot see) I show the flow:
- Initial Controller; Class in storyboard - Empty leads to (segue has no name)
- Welcome Controller; Class in storyboard - WelcomeController (script) leads to (segue has no name)
- Menu Navigation Controller; Class in storyboard - empry leads to (segue has no name)
- New Main Controller; Class in storyboard - NewMainController leads to (segue has a name - burgerSegue)
- Side Navigation Controller (from pods SideMenu); Class in storyboard - SideNavigationController (as in documentation + module = SideMenu) leads to (segue has no name)
- ViewController (where I store my SideMenu); Class in storyboard - empty leads to (segue has a name - finalSegueToMenu)
- Menu Controller; Class in storyboard - SideMenuButtons (script)
Ideally, I was trying to connect NewMainController and MenuController with delegates.
This is what I had in MenuController:
@IBAction func logoutClicked(_ sender: Any)
{
if delegate == nil {
print("Delegate is nil")
} else {
print("Delegate is set")
delegate?.logoutClickedInSideMenu()
}
print("Logout button clicked")
}
Yet, each time I got Delegate is nil.
Could it be that my whole approach is wrong and there is a simpler option?
Important: SideMenu is created in Storyboard, not in programmatically.
Thanks!
