canvas.addPanGestureRecognizer { (locations, translation, velocity, state) -> () in
print(locations)
}
And...
internal class PanGestureHandler: NSObject {
let action: PanAction
init(_ action: PanAction) {
self.action = action
}
func handleGesture(gestureRecognizer: UIPanGestureRecognizer) {
var locations = [Point]()
for i in 0..<gestureRecognizer.numberOfTouches() {
let p = Point(gestureRecognizer.locationOfTouch(i, inView: gestureRecognizer.referenceView))
locations.append(p)
}
action(locations: locations, translation: gestureRecognizer.translation, velocity: gestureRecognizer.velocity, state: gestureRecognizer.state)
}
}
And...
public typealias PanAction = (locations: [Point], translation: Vector, velocity: Vector, state: UIGestureRecognizerState) -> ()