title: How to know if UIBarButtonItem is pressed?
body: <p>I have tried numerous options for this code to work but I don't find a proper way. I know that this method works with UIButtons but with UIBarButtonItems it seems is different. </p>
  
  <pre><code>@IBOutlet weak var stopOutlet: UIBarButtonItem!
  
  @IBAction func stop(sender: AnyObject) {
  
      if stopOutlet.selected {
  
          player.stop()
  
      } else {
  
          player.play()
  
          do {
              try player = AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: audioPath))
  
          } catch {
              print("Unable to play the file. Please try another song")
          }
      }
  }
  </code></pre>
  
  <p>The line of code that does not work is the following </p>
  
  <pre><code>if stopOutlet.selected
  </code></pre>
  
  <p>Is there any boolean that works with UIBarButtonItems??? </p>
  
  <p>Im just starting to learn swift and Xcode so sorry if the question is lame. </p>