<!--
{
  "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

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

The Caps Lock key has been pressed.

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

The Shift key has been pressed.

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

The Control key has been pressed.

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

The Option or Alt key has been pressed.

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

The Command key has been pressed.

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

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

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

The Help key has been pressed.

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

A function key has been pressed.

[`deviceIndependentFlagsMask`](/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.



---

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)