<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIEvent",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIEvent"
  },
  "title" : "UIEvent"
}
-->

# UIEvent

An object that describes a single user interaction with your app.

```
@MainActor class UIEvent
```

## Overview

Apps can receive many different types of events, including touch events, motion events, remote-control events, and press events. Touch events are the most common and are delivered to the view in which the touch originally occurred. Motion events are UIKit triggered and are separate from the motion events reported by the Core Motion framework. Remote-control events allow a responder object to receive commands from an external accessory or headset so that it can manage audio and video — for example, playing a video or skipping to the next audio track. Press events represent interactions with a game controller, Apple TV remote, or other device that has physical buttons. You can determine the type of an event using the [`type`](/documentation/UIKit/UIEvent/type) and [`subtype`](/documentation/UIKit/UIEvent/subtype) properties.

A touch event object contains the touches (that is, the fingers on the screen) that have some relation to the event. A touch event object may contain one or more touches, and each touch is represented by a [`UITouch`](/documentation/UIKit/UITouch) object. When a touch event occurs, the system routes it to the appropriate responder and calls the appropriate method, such as [`touchesBegan(_:with:)`](/documentation/UIKit/UIResponder/touchesBegan(_:with:)). The responder then uses the touches to determine an appropriate course of action.

During a multitouch sequence, UIKit reuses the same [`UIEvent`](/documentation/UIKit/UIEvent) object when delivering updated touch data to your app. You should never retain an event object or any object returned from an event object. If you need to retain data outside of the responder method you use to process that data, copy that data from the [`UITouch`](/documentation/UIKit/UITouch) or [`UIEvent`](/documentation/UIKit/UIEvent) object to your local data structures.

For more information on how to handle events in your UIKit app, see [Event Handling Guide for UIKit Apps](https://developer.apple.com/library/archive/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/index.html#//apple_ref/doc/uid/TP40009541).

## Topics

### Getting the touches for an event

[`allTouches`](/documentation/UIKit/UIEvent/allTouches)

All touches associated with the event.

[`touches(for:)`](/documentation/UIKit/UIEvent/touches(for:)-9neb4)

Returns the touch objects from the event that belong to the specified given view.

[`touches(for:)`](/documentation/UIKit/UIEvent/touches(for:)-767rm)

Returns the touch objects from the event that belong to the specified window.

[`coalescedTouches(for:)`](/documentation/UIKit/UIEvent/coalescedTouches(for:))

Returns all of the touches associated with the specified main touch.

[`predictedTouches(for:)`](/documentation/UIKit/UIEvent/predictedTouches(for:))

Returns an array of touches that are predicted to occur for the specified touch.

### Getting event attributes

[`timestamp`](/documentation/UIKit/UIEvent/timestamp)

The time when the event occurred.

### Getting the event type

[`type`](/documentation/UIKit/UIEvent/type)

Returns the type of the event.

[`UIEvent.EventType`](/documentation/UIKit/UIEvent/EventType)

Constants that specify the general type of an event.

[`subtype`](/documentation/UIKit/UIEvent/subtype)

Returns the subtype of the event.

[`UIEvent.EventSubtype`](/documentation/UIKit/UIEvent/EventSubtype)

Constants that specify the subtype of the event in relation to its general type.

### Getting the touches for a gesture recognizer

[`touches(for:)`](/documentation/UIKit/UIEvent/touches(for:)-6krou)

Returns the touch objects that are being delivered to the specified gesture recognizer.

### Getting the button mask

[`buttonMask`](/documentation/UIKit/UIEvent/buttonMask-swift.property)

A bit mask that represents which input-device buttons are pressed for the current event.

[`UIEvent.ButtonMask`](/documentation/UIKit/UIEvent/ButtonMask-swift.struct)

Constants that indicate which input-device buttons are pressed.

### Getting the modifier flags

[`modifierFlags`](/documentation/UIKit/UIEvent/modifierFlags)

The set of modifier keys that are pressed for the current event.

[`UIKeyModifierFlags`](/documentation/UIKit/UIKeyModifierFlags)

Constants that indicate which modifier keys are pressed.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)