title: Swift `UIMenuController` custom action
body: <p>I have implemented custom text view using <code>TextKit</code>. Also I have custom text selection implemented with <code>UILongPressGesture</code>. I've made progress in copying selected text with standard pop-up menu <code>UIMenuController</code>. </p>
  
  <p>I want to implement custom text definition. Either overriding standard define action (have no clue if it's even exist) or with custom <code>UIMenuItem</code>.</p>
  
  <p>So far, I have following:</p>
  
  <pre><code>@objc func longTap(sender: UILongPressGestureRecognizer) {
      ...
      becomeFirstResponder()
      let copyItem = UIMenuItem(title: "Copy", action: #selector(copySelector))
      let defineItem = UIMenuItem(title: "Define", action: #selector(defineSelector))
      UIMenuController.shared.menuItems = [copyItem, defineItem]
      UIMenuController.shared.setTargetRect(...)
      UIMenuController.shared.setMenuVisible(true, animated: true)
  }
  
  override func canPerformAction(_ action: Selector, withSender sender: Any?) -&gt; Bool {
      if action == #selector(CenterViewController.copySelector) {
          return true
      } else if action == #selector(CenterViewController.defineSelector) {
          return true
      }
      return false
  }
  
  ....
  
  @objc func defineSelector() {
      // Use device's dictionary? 
      // ??
      customTextView.clearSelection()
  }
  </code></pre>
  
  <p>And here's question: How to implement <code>defineSelector</code>?</p>
  
  <p>I have searched everywhere, but there is no answers.
  Is there any way to use dictionaries and present modal view with definitions? As it is done by system with any selected text.</p>