Skip to content

Instantly share code, notes, and snippets.

@mczachurski
Created January 21, 2018 16:53
Show Gist options
  • Save mczachurski/a12d9545eb8916a904fd4ca8a5ec56d1 to your computer and use it in GitHub Desktop.
Save mczachurski/a12d9545eb8916a904fd4ca8a5ec56d1 to your computer and use it in GitHub Desktop.
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent) {
super.touchesMoved(touches, with: event)
if state == .failed || touches.count != 2 {
return
}
let window = view?.window
let arrayTouches = Array(touches)
// First finger
if let loc = arrayTouches.first?.location(in: window) {
firstTouchedPoints.append(loc)
state = .changed
}
// Second finger
if let loc = arrayTouches.last?.location(in: window) {
secondTouchedPoints.append(loc)
state = .changed
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment