Last active
August 29, 2015 14:04
-
-
Save dethell/bd693a3ec2c10717fbf7 to your computer and use it in GitHub Desktop.
Swift version of viewWillDisappear needed for custom storyboard back button behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewWillDisappear(animated:Bool) { | |
if let currentViewControllers = self.navigationController.viewControllers as? [UIViewController] { | |
if let found = find(currentViewControllers, self) { | |
// Do nothing if the current controller is still in the stack. This means we're going forward, not back | |
} | |
else { | |
self.performSegueWithIdentifier("unwindToLogin", sender:self) | |
} | |
} | |
super.viewWillDisappear(animated) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment