Instantly share code, notes, and snippets.

What would you like to do?
Swift function to check if a view controller is being presented modally.
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