Instance Method


Tells this object that one or more new touches occurred in a view or window.


func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)



A set of UITouch instances that represent the touches for the starting phase of the event, which is represented by event. For touches in a view, this set contains only one touch by default. To receive multiple touches, you must set the view's isMultipleTouchEnabled property to true.


The event to which the touches belong.


UIKit calls this method when a new touch is detected in a view or window. Many UIKit classes override this method and use it to handle the corresponding touch events. The default implementation of this method forwards the message up the responder chain. When creating your own subclasses, call super to forward any events that you do not handle yourself. For example,

[super touchesBegan:touches withEvent:event];

If you override this method without calling super (a common use pattern), you must also override the other methods for handling touch events, even if your implementations do nothing.

See Also

Related Symbols

func touchesEnded(Set<UITouch>, with: UIEvent?)

Tells the responder when one or more fingers are raised from a view or window.

func touchesMoved(Set<UITouch>, with: UIEvent?)

Tells the responder when one or more touches associated with an event changed.

func touchesCancelled(Set<UITouch>, with: UIEvent?)

Tells the responder when a system event (such as a system alert) cancels a touch sequence.