Detecting touch input on iOS devices
Detecting touch
You can override 4 methods of SKScene
to detect user touch
class GameScene: SKScene {
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
}
override func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) {
}
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
}
override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
}
}
Please note that each method receives a
touches
parameter which (under particular circumstances) can contain more then one single touch event.