title: Showing dropdown menu (popover) below BarButtonItem on click
body: <p>When I click "+" I want to show menu (popover) under the right BarButtonItem where will be two options. Pressing one of those options will lead to other view controllers.</p>
  
  <p>I'm using Xcode 10 and Swift 4.2.</p>
  
  <p><a href="https://i.stack.imgur.com/U0WbP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/U0WbP.png" alt="enter image description here"></a></p>
  
  <p>Like this:
  <a href="https://i.stack.imgur.com/ohL4e.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ohL4e.png" alt="enter image description here"></a></p>
  
  <p>This is my code for now and nothing happen. What i do wrong? Can i write on different way?</p>
  
  <pre><code>import Foundation
  
  class RootVC: UITableViewController {
  
      @IBOutlet weak var openSideMenu: UIBarButtonItem!
  
      let itemArray = ["1", "2", "3"]
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          openSideMenu.target = self.revealViewController()
          openSideMenu.action = #selector(SWRevealViewController.revealToggle(_:))
      }
  
      override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return itemArray.count
      }
  
      override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "RootCell", for: indexPath)
  
          cell.textLabel?.text = itemArray[indexPath.row]
  
          return cell
      }
  
      @IBAction func addBarButtonPressed(_ sender: UIBarButtonItem) {
          let menu = UIMenuController.shared
          menu.menuItems =
              [UIMenuItem(title: "Test me", action: Selector("deleteLine")),
               UIMenuItem(title: "Test me", action: Selector("deleteLine")),
               UIMenuItem(title: "Test me", action: Selector("deleteLine"))]
  
          menu.setTargetRect((self.navigationItem.rightBarButtonItems?.first?.frame)!, in: self.view)
          becomeFirstResponder()
          menu.setMenuVisible(true, animated: true)
  
      }
  
  }
  extension UIBarButtonItem {
  
      var frame: CGRect? {
          guard let view = self.value(forKey: "view") as? UIView else {
              return nil
          }
          return view.frame
      }
  
  }
  </code></pre>