Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@objc func didPanView(sender: UIPanGestureRecognizer) {
let viewToMove = sender.view!
view.bringSubview(toFront: viewToMove)
let translation = sender.translation(in: view)
let newCenter = CGPoint(x: viewToMove.center.x + translation.x, y: viewToMove.center.y + translation.y)
viewToMove.center = newCenter
sender.setTranslation(CGPoint.zero, in: view)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.