Created
April 4, 2016 20:52
-
-
Save edenwaith/c9de3000d8a9067daaca8f3caa1e43a4 to your computer and use it in GitHub Desktop.
Swift function to check if a view controller is being presented modally.
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
func isModal() -> Bool { | |
return self.presentingViewController?.presentedViewController == self | |
|| (self.navigationController != nil && self.navigationController?.presentingViewController?.presentedViewController == self.navigationController) | |
|| self.tabBarController?.presentingViewController is UITabBarController | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment