Create a gist now

Instantly share code, notes, and snippets.

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