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
 
     
    