Skip to content

Instantly share code, notes, and snippets.

@stevencurtis
Last active May 18, 2020 10:35
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 stevencurtis/cae13334ddc6b6863ef8810e90053d4b to your computer and use it in GitHub Desktop.
Save stevencurtis/cae13334ddc6b6863ef8810e90053d4b to your computer and use it in GitHub Desktop.
handlepangesture
@objc func handlePan(_ sender: UIPanGestureRecognizer) {
guard let targetView = sender.view else {return}
let translation = sender.translation(in: view)
targetView.center = CGPoint(x: targetView.center.x + translation.x
,y: targetView.center.y + translation.y)
sender.setTranslation(CGPoint.zero, in: view)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment