-4

This code i got from my friend. But i don't know how it work. I hope some one in here can help me to explain this code. Because i have to explain it to my teacher.

    private func isModal() -> Bool {
    if self.presentingViewController != nil {
        return true
    } else if self.navigationController?.presentingViewController?.presentedViewController == self.navigationController  {
        return true
    } else if self.tabBarController?.presentingViewController is UITabBarController {
        return true
    }

    return false
}

thanks :D

Slimane amiar
  • 934
  • 12
  • 27
Dodi
  • 141
  • 2
  • 13

1 Answers1

0

Let me explain you.

When you call .isModel() function from any class it will check and return you bool value according.

First condition which means of presentingview controller is initialized then it will return true.

The code is only to check if any class is presented or not

vivek bhoraniya
  • 1,526
  • 2
  • 17
  • 36