Last active
May 18, 2020 10:35
-
-
Save stevencurtis/cae13334ddc6b6863ef8810e90053d4b to your computer and use it in GitHub Desktop.
handlepangesture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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