For example responding to a touch (or click) uses the touchesBegan function.
override func touchesBegan(_ touches: Set, with event: UIEvent?) { for touch in touches { let location = touch.location(in: self) } }
This code detects the beginning of a touch and returns the location from touches set. This could be used to place an item or with SpriteKit, a node.
touchesMoved and touchesEnded could be used to detect movement during a touch and when the touch ends.
override func touchesMoved(_ touches: Setor, with event: UIEvent?) { for touch in touches { let location = touch.location(in: self) } }
override func touchesEnded(_ touches: Set, with event: UIEvent?) { for touch in touches { let location = touch.location(in: self) } }
More information can be found the Help for UITouch class