Get touch window coordinates in gesture recognizer in Swift?
I am dragging a CALayer from one UIView to another using the UIPanGestureRecognizer. In the UIGestureRecognizerState.Changed method, I am calling to move the CALayer using
var touchLocation = recognizer.locationInView(recognizer.view)
self.panForTranslation(touchLocation)
However, touchLocation returns the position of the CALayers relative to the frame, not the screen coordinates.
How can I get the UITouch location of the exact point the finger is on?
+3
source to share