Skip to content

Instantly share code, notes, and snippets.

@edenwaith
Created April 4, 2016 20:52
Show Gist options
  • Save edenwaith/c9de3000d8a9067daaca8f3caa1e43a4 to your computer and use it in GitHub Desktop.
Save edenwaith/c9de3000d8a9067daaca8f3caa1e43a4 to your computer and use it in GitHub Desktop.
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