title: How to get the current visible viewController from AppDelegate
body: <p>So, I'm using the method bellow from <code>UIApplication</code> extension to get the top view controller:</p>
  
  <pre><code>    class func topViewController(controller: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -&gt; UIViewController? {
      if let navigationController = controller as? UINavigationController {
          return topViewController(controller: navigationController.visibleViewController)
      }
      if let tabController = controller as? UITabBarController {
          if let selected = tabController.selectedViewController {
              return topViewController(controller: selected)
          }
      }
      if let presented = controller?.presentedViewController {
          return topViewController(controller: presented)
      }
      return controller
  }
  </code></pre>
  
  <p>But the problem is: It always returns <code>UIViewController</code>. But I need to check if it is <code>MyViewController</code> for example. How do I achieve that?</p>