<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSEvent/ModifierFlags-swift.struct",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:@E@NSEventModifierFlags"
  },
  "title" : "NSEvent.ModifierFlags"
}
-->

# NSEvent.ModifierFlags

Flags that represent key states in an event object.

```
struct ModifierFlags
```

## Topics

### Event Modifier Flags

[`NSEventModifierFlagCapsLock`](/documentation/AppKit/NSEvent/ModifierFlags-swift.struct/capsLock)

The Caps Lock key has been pressed.

[`NSEventModifierFlagShift`](/documentation/AppKit/NSEvent/ModifierFlags-swift.struct/shift)

The Shift key has been pressed.

[`NSEventModifierFlagControl`](/documentation/AppKit/NSEvent/ModifierFlags-swift.struct/control)

The Control key has been pressed.

[`NSEventModifierFlagOption`](/documentation/AppKit/NSEvent/ModifierFlags-swift.struct/option)

The Option or Alt key has been pressed.

[`NSEventModifierFlagCommand`](/documentation/AppKit/NSEvent/ModifierFlags-swift.struct/command)

The Command key has been pressed.

[`NSEventModifierFlagNumericPad`](/documentation/AppKit/NSEvent/ModifierFlags-swift.struct/numericPad)

A key in the numeric keypad or an arrow key has been pressed.

[`NSEventModifierFlagHelp`](/documentation/AppKit/NSEvent/ModifierFlags-swift.struct/help)

The Help key has been pressed.

[`NSEventModifierFlagFunction`](/documentation/AppKit/NSEvent/ModifierFlags-swift.struct/function)

A function key has been pressed.

[`NSEventModifierFlagDeviceIndependentFlagsMask`](/documentation/AppKit/NSEvent/ModifierFlags-swift.struct/deviceIndependentFlagsMask)

Device-independent modifier flags are masked.

### Initializers

### Deprecated

[`init(rawValue:)`](/documentation/AppKit/NSEvent/ModifierFlags-swift.struct/init(rawValue:))

[`NSAlphaShiftKeyMask`](/documentation/AppKit/NSAlphaShiftKeyMask)

The Caps Lock key has been pressed.

[`NSShiftKeyMask`](/documentation/AppKit/NSShiftKeyMask)

The Shift key has been pressed.

[`NSControlKeyMask`](/documentation/AppKit/NSControlKeyMask)

The Control key has been pressed.

[`NSAlternateKeyMask`](/documentation/AppKit/NSAlternateKeyMask)

The Option or Alt key has been pressed.

[`NSCommandKeyMask`](/documentation/AppKit/NSCommandKeyMask)

The Command key has been pressed.

[`NSNumericPadKeyMask`](/documentation/AppKit/NSNumericPadKeyMask)

A key in the numeric keypad or an arrow key has been pressed.

[`NSHelpKeyMask`](/documentation/AppKit/NSHelpKeyMask)

The Help key has been pressed.

[`NSFunctionKeyMask`](/documentation/AppKit/NSFunctionKeyMask)

A function key has been pressed.

[`NSDeviceIndependentModifierFlagsMask`](/documentation/AppKit/NSDeviceIndependentModifierFlagsMask)

Device-independent modifier flags are masked.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

---

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)