title: Long press delete key of a custom keyboard in swift
body: <p>I am making a custom keyboard. The delete key in the keyboard works fine for single tap. But it does not work for long press.I want to implement the long press on the delete key so that when the user holds down the delete button, the keyboard continuously deletes like in the standard ios keyboard. I referred to a couple of solutions on Stackoverflow, like- <a href="https://stackoverflow.com/a/26234876/6077720">https://stackoverflow.com/a/26234876/6077720</a>,
  <a href="https://stackoverflow.com/a/25633313/6077720">https://stackoverflow.com/a/25633313/6077720</a>, <a href="https://stackoverflow.com/a/30711421/6077720">https://stackoverflow.com/a/30711421/6077720</a></p>
  
  <p>But none of it worked for me. I also tried this code: </p>
  
  <pre><code>  override func viewDidLoad() {
      super.viewDidLoad()
      textDocument = self.textDocumentProxy
  
      var longPress = UILongPressGestureRecognizer(target: self, action: #selector(self.longPress))
      self.deleteKeyPressed.addGestureRecognizer(longPress)
  }
  
  func longPress(gesture: UILongPressGestureRecognizer) {
      if gesture.state == .Ended {
          print("Long Press")
          self.textDocumentProxy.deleteBackward()
  
      }
  }
  </code></pre>
  
  <p>But after writing this code my keyboard does not appear only. Can anyone please help me?</p>