title: How to compare UIViewController in Swift 3?
body: <p>I am trying to compare to UIViewController in Swift 3 but there is some error </p>
  
  <pre><code>extension UINavigationController
  {
      func myPopToViewController(viewController:UIViewController, animated:Bool) -&gt; UIViewController? {
          var arrViewControllers:[UIViewController] = []
  
          arrViewControllers = self.viewControllers
          for vc:UIViewController in arrViewControllers {
              if(vc.isKind(of: viewController) ) // This Line gives me error
              {
                  return (self.navigationController?.popToViewController(vc, animated: animated)?.last)!
              }
  
          }
          return nil
      }
  
  }
  </code></pre>
  
  <blockquote>
    <p>/Users/varunnaharia/Documents/Projects/appname/appname/Public/UINavigationController+Extra.swift:18:30: Cannot convert value of type 'UIViewController' to expected argument type 'AnyClass' (aka 'AnyObject.Type')</p>
  </blockquote>
  
  <p>and if try to use </p>
  
  <pre><code>if(vc is viewController)
  </code></pre>
  
  <p>It gives </p>
  
  <blockquote>
    <p>/Users/varunnaharia/Documents/Projects/appname/appname/Public/UINavigationController+Extra.swift:18:22: Use of undeclared type 'viewController'</p>
  </blockquote>
  
  <p>I am calling it through this</p>
  
  <pre><code>self.navigationController?.popOrPopToViewController(viewController: MyUIViewController(), animated: false)
  </code></pre>