Skip to content

Instantly share code, notes, and snippets.

@SergLam
Created April 12, 2019 13:23
Show Gist options
  • Save SergLam/36461ebfc8847d60a363698efa7023bd to your computer and use it in GitHub Desktop.
Save SergLam/36461ebfc8847d60a363698efa7023bd to your computer and use it in GitHub Desktop.
Check if viewController isModal
func isModal() -> Bool {
let presentingIsModal = presentingViewController != nil
let presentingIsNavigation = navigationController?.presentingViewController?.presentedViewController == navigationController
let presentingIsTabBar = tabBarController?.presentingViewController is UITabBarController
return presentingIsModal || presentingIsNavigation || presentingIsTabBar
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment