<!--
{
  "availability" : [
    "iOS: 13.4.0 -",
    "iPadOS: 13.4.0 -",
    "macCatalyst: 13.4.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIEvent/ButtonMask-swift.struct",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:@E@UIEventButtonMask"
  },
  "title" : "UIEvent.ButtonMask"
}
-->

# UIEvent.ButtonMask

Constants that indicate which input-device buttons are pressed.

```
struct ButtonMask
```

## Topics

### Creating button masks

[`init(rawValue: Int)`](/documentation/UIKit/UIEvent/ButtonMask-swift.struct/init(rawValue:))

Creates a button mask with the specified raw value.

[`static func button(Int) -> UIEvent.ButtonMask`](/documentation/UIKit/UIEvent/ButtonMask-swift.struct/button(_:))

Creates a button mask from the specified button index.

### Accessing button masks

[`static var primary: UIEvent.ButtonMask`](/documentation/UIKit/UIEvent/ButtonMask-swift.struct/primary)

A constant that represents the primary button on the input device.

[`static var secondary: UIEvent.ButtonMask`](/documentation/UIKit/UIEvent/ButtonMask-swift.struct/secondary)

A constant that represents the secondary button on the input device.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`ExpressibleByArrayLiteral`](/documentation/Swift/ExpressibleByArrayLiteral)

[`SetAlgebra`](/documentation/Swift/SetAlgebra)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`OptionSet`](/documentation/Swift/OptionSet)

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`Equatable`](/documentation/Swift/Equatable)

---

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)