---
title: "touchesBegan(_:with:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiresponder/touchesbegan(_:with:)"
---

# touchesBegan(_:with:)

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

## Declaration

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

## Parameters

- `touches`: A set of doc://com.apple.uikit/documentation/UIKit/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 doc://com.apple.uikit/documentation/UIKit/UIView/isMultipleTouchEnabled property to doc://com.apple.documentation/documentation/Swift/true.
- `event`: The event to which the touches belong.

## Mentioned in

Implementing a Multi-Touch app Implementing a Continuous Gesture Recognizer Implementing a discrete gesture recognizer Implementing coalesced touch support in an app

## Discussion

Discussion 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 don’t handle yourself, like in the following code. 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. note: In iOS 17, Messages allows you to interactively resize iMessage apps with a vertical pan gesture. Messages handles any conflicts between resize gestures and your custom gestures. If your app uses manual touch handling, override those methods in your app’s UIView. You can either change your manual touch handling code to use a gesture recognizer instead, or your UIView can override gestureRecognizerShouldBegin(_:) and return NO when your iMessage app doesn’t own the gesture.

## See Also

### Responding to touch events

- [touchesMoved(_:with:)](uikit/uiresponder/touchesmoved(_:with:).md)
- [touchesEnded(_:with:)](uikit/uiresponder/touchesended(_:with:).md)
- [touchesCancelled(_:with:)](uikit/uiresponder/touchescancelled(_:with:).md)
- [touchesEstimatedPropertiesUpdated(_:)](uikit/uiresponder/touchesestimatedpropertiesupdated(_:).md)
