title: Swift Get Direction of Swipe Gesture
body: <p>I am creating a UIButton in Swift with the following code:</p>
  
  <pre><code>let button = UIButton()
  button.addTarget(self, action: "tileSwiped:", forControlEvents: .TouchDragExit)
  </code></pre>
  
  <p>My tileSwiped function definition is as follows:</p>
  
  <pre><code>func tileSwiped(button: UIButton) {
  }
  </code></pre>
  
  <p>What I would like to do is determine which direction the TouchDragExit event occurred in. More specifically, my button is a rectangle, and I would like to know if the drag exited on the top, bottom, left, or right edge of the rectangle.</p>
  
  <p>However, I don't see a way to do this without having access to the motion event that triggered the function call. But of course, I can't change the parameters passed to the tileSwiped function. So how can I get the direction of the "swipe"?</p>
  
  <p>(I'm open to changing my approach to listening for the gesture because I don't think this approach will get me anywhere, but note that I do need to keep the button as a parameter.)</p>