IcaliaLabs / LoginKit

LoginKit is a quick and easy way to add a Login/Signup UX to your iOS app.
MIT License
662 stars 90 forks source link

De-Init loginCoordinator not happening & #34

Open ghost opened 6 years ago

ghost commented 6 years ago

Hello,

Thanks for the repo, great help, but I’ve spent over 12 hours in past 2 days trying to make it work but it won’t. . I’m using fire base function where authentication state change, when successful log in, triggers function in appdelegate to perform .finish() and change root view controllers. . But looking at view heirachy, and tracking initial controller & coordinator, the last two never get de-unit. And the initial view controller remains as controller and just its view in the system. . Also lastly when I’m trying to change rootviewcontroller from let to var, in coordinator class, since maybe that is causing retain cycle, it throws runtime error, and overall not letting me edit pod file without errors. . Appreciated if you do respond. Been blowing my brain with this for past two days.

ghost commented 6 years ago

Solution: From VC (vc1) where you have loginCoordinator, create another VC (vc2). Present that onto vc1. Then pass vc2 as root to the LoginCoordinator. When logged in, finish() on the coordinator, then dismiss vc2 from vc1 by calling vc1.dismiss(). This should end this retain cycle.