title: Adding gestures to a button in swift
body: <p>I'm trying to add gesture(swipe) functionality to an existing button in my view but I can't figure out how to attach the swipe to the button's area.</p>
  
  <p>The desired effect is to have a button I can press as well as swipe to produce different outcomes. So far the way I'm implementing gestures applies it to my entire view not just the button. </p>
  
  <p>I have a feeling it's pretty simple but it's been escaping me for a couple of days - I might just be searching for the wrong thing.</p>
  
  <p>(I'm assigning '@IBOutlet var swipeButton: UIButton!' to my button BTW)</p>
  
  <p>Code below:</p>
  
  <pre><code>class ViewController: UIInputViewController {
  
  @IBOutlet var swipeButton: UIButton!
  
  let swipeRec = UISwipeGestureRecognizer()
  
  override func viewDidLoad() {
      super.viewDidLoad()
      self.loadInterface()
  
      var swipeButtonDown: UISwipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: "ButtonDown")
      swipeButtonDown.direction = UISwipeGestureRecognizerDirection.Down
      self.view.addGestureRecognizer(swipeButtonDown)
  }
  
  @IBAction func buttonPressed(sender: UIButton) {
      var proxy = textDocumentProxy as UITextDocumentProxy
      proxy.insertText("button")
  }
  func buttonDown(){
      var proxy = textDocumentProxy as UITextDocumentProxy
      proxy.insertText("swipe")
  }
  
  }
  </code></pre>