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

# pressesBegan(_:with:)

Tells this object when a physical button is first pressed.

## Declaration

```swift
func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?)
```

## Parameters

- `presses`: A set of doc://com.apple.uikit/documentation/UIKit/UIPress instances that represent the new presses that occurred. The phase of each press is set to doc://com.apple.uikit/documentation/UIKit/UIPress/Phase-swift.enum/began.
- `event`: The event to which the presses belong.

## Mentioned in

Handling key presses made on a physical keyboard

## Discussion

Discussion UIKit calls this method when a new button is pressed by the user. Use this method to determine which button was pressed and to take any needed actions. 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.

## See Also

### Responding to press events

- [pressesChanged(_:with:)](uikit/uiresponder/presseschanged(_:with:).md)
- [pressesEnded(_:with:)](uikit/uiresponder/pressesended(_:with:).md)
- [pressesCancelled(_:with:)](uikit/uiresponder/pressescancelled(_:with:).md)
