Skip to content

Instantly share code, notes, and snippets.

@jongwonwoo
Created March 25, 2016 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jongwonwoo/b7d799441ef5d893b2da to your computer and use it in GitHub Desktop.
Save jongwonwoo/b7d799441ef5d893b2da to your computer and use it in GitHub Desktop.
class ViewController: UIViewController {
@IBAction func handlePan(recognizer: UIPanGestureRecognizer) {
let currentPoint = recognizer.translationInView(self.view)
if let stateMachine = self.stateMachine {
switch recognizer.state {
case .Began, .Changed:
stateMachine.keepMoving(currentPoint)
default:
stateMachine.stopMoving()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment