John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 988 forks source link

Return from Registration to login gives Nil error #759

Open FahdSaif opened 6 years ago

FahdSaif commented 6 years ago

I have a login page view controller with SWreveal view controller. Everything works fine if I hit the login button and segue to my next view controller where i can see the sliding menus. However, "IF" before I hit the login button and press the registration button, on the login view controller, and "THEN" hit the login button, I get an error, found NIL while unwrapping an optional on this line:

        revealViewController().setFront(controller, animated: true)

Attached is a screen shot when the error comes.

Can you please suggest what I might be doing wrong here...I am, using the show segue when I come from the registration screen to the login screen.

The error only comes if i goto another view controller before hitting the login button.

Here is the code on the login button:

let sb = UIStoryboard(name: "Main", bundle: nil) let controller = sb.instantiateViewController(withIdentifier: "tabmain") revealViewController().setFront(controller, animated: true)

Thanks FAHD

screen shot 2017-12-06 at 10 52 14 pm

swerror

iDevelopper commented 6 years ago

When you come back to login controller from registration controller don't use the show segue, but dismiss (if modal) the registration controller to come back. Or popViewController if pushed.

FahdSaif commented 6 years ago

Thanks a lot Patrick. That worked like a charm.