iDevelopper / PBRevealViewController

A UIViewController subclass for revealing a left and/or right view controller above or below a main view controller.
MIT License
80 stars 16 forks source link

revealViewController() is coming back nil #79

Closed justdan0227 closed 3 years ago

justdan0227 commented 4 years ago

I have a function in my menuViewController to log out the user and return to the "main" login window. When I press the push button in my menu this works just fine. However, if I listen for a logout broadcast message and then try to call the same code in my menuViewController, revealViewController() comes back as nil?

var controller: UIViewController? controller = storyboard.instantiateViewController(withIdentifier: "MainViewController")

    if (controller != nil) {
        let nc = UINavigationController(rootViewController: controller!)
         revealViewController()!.pushMainViewController(nc, animated:true) <-- Fails
    }
iDevelopper commented 4 years ago

Could you provide more code please. I'm not sure to understand. What is the code for log out the user?