title: UIBarButtonItem -> unrecognized selector sent to instance
body: <p>I have a UIBarButtonItem and i want to pushViewController in an other class. So i have this line of code in viewDidLoad :</p>
  
  <pre><code>self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named:"settings"), style: .plain, target: self, action: #selector(GoToPages.goToSettings(_:)))
  </code></pre>
  
  <p>This is my GoToPages class :</p>
  
  <pre><code>import UIKit
  
  class GoToPages: UIViewController {
  
     @objc func goToSettings(_ sender:UIBarButtonItem) {
  
          let button = sender
  
          switch button.tag {
          case 0:
              let settingsPageView = self.storyboard?.instantiateViewController(withIdentifier: "Notifications")
              self.navigationController?.pushViewController(settingsPageView!, animated: true)
          case 1:
              let settingsPageView = self.storyboard?.instantiateViewController(withIdentifier: "Settings")
              self.navigationController?.pushViewController(settingsPageView!, animated: true)
          default:
              return
          }
      }
  }
  </code></pre>
  
  <p>But i get an error :  unrecognized selector sent to instance.</p>