title: Adding custom item to Table View in Swift
body: <p>I am trying to add a custom item to my table view menu which is found in <code>ViewController</code>. I've implemented all necessary methods but my item still does not show up. If I use default items, like "copy" everything works fine. I left out performAction method, because I don't really know what to add there, but copy action showed up without it. Could you tell me what I am getting wrong? I've attached my code to add custom menu item below:</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      let item = UIMenuItem(title: "Block and Report", action: #selector(MessageViewController.blockAndReport(_:)))
  
      let menu = UIMenuController.sharedMenuController()
  
      var newItems = menu.menuItems
          ?? [UIMenuItem]()
      newItems.append(item)
      menu.menuItems = newItems ...}
  
  func tableView(tableView: UITableView, shouldShowMenuForRowAtIndexPath indexPath: NSIndexPath) -&gt; Bool {
      return true
  }
  
  func tableView(tableView: UITableView, canPerformAction action: Selector, forRowAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) -&gt; Bool {
  
      if action == #selector(MessageViewController.blockAndReport(_:)) {
          return true
      }
  
  
      return false
  }
  
  func tableView(tableView: UITableView, performAction action: Selector, forRowAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) {
  
      //I don't really know what to add here
  }
  
  func blockAndReport(sender: AnyObject?) {
  
      print("Hello")
  
  }
  </code></pre>