Elegant way to do animation after view controller transition (unwind segue, navigation push/pop)

Question

So I have two view controllers:

Login Page -> Main Page

When user returns to the Login Page after logging out from the Main Page, I want to do animation or show alert message.

I can do animation or show alert message in the Login Page by having a boolean property and checking in viewDidAppear

-(void) viewDidAppear {
    if (returningFromMainPage) {
        // Call animation or show alert message function
        returningFromMainPage = false
    }
}

This works fine, but I don't like the fact I have to have extra property just to check whether I'm returning or not. Is there a more elegant way to do this without an extra property?

Posted Feb 25, 2016, 12:45 AM UTC

110
Loading comments…