---
title: XCUIElement.KeyModifierFlags
framework: xcuiautomation
role: symbol
role_heading: Structure
path: xcuiautomation/xcuielement/keymodifierflags
---

# XCUIElement.KeyModifierFlags

Flags for simulating combination keystrokes with keys, such as Control, Option, Shift, and Command.

## Declaration

```swift
struct KeyModifierFlags
```

## Overview

Overview Use these flags with the typeKey(_:modifierFlags:) and perform(withKeyModifiers:block:) methods to simulate combination keystrokes while an action occurs.

## Topics

### Flags for combination keys

- [command](xcuiautomation/xcuielement/keymodifierflags/command.md)
- [control](xcuiautomation/xcuielement/keymodifierflags/control.md)
- [option](xcuiautomation/xcuielement/keymodifierflags/option.md)
- [shift](xcuiautomation/xcuielement/keymodifierflags/shift.md)
- [capsLock](xcuiautomation/xcuielement/keymodifierflags/capslock.md)
- [function](xcuiautomation/xcuielement/keymodifierflags/function.md)

### Initializers

- [init(rawValue:)](xcuiautomation/xcuielement/keymodifierflags/init(rawvalue:).md)

### Legacy flags for combination keys

- [alphaShift](xcuiautomation/xcuielement/keymodifierflags/alphashift.md)
- [alternate](xcuiautomation/xcuielement/keymodifierflags/alternate.md)

## Relationships

### Conforms To

- [BitwiseCopyable](swift/bitwisecopyable.md)
- [Equatable](swift/equatable.md)
- [ExpressibleByArrayLiteral](swift/expressiblebyarrayliteral.md)
- [OptionSet](swift/optionset.md)
- [RawRepresentable](swift/rawrepresentable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [SetAlgebra](swift/setalgebra.md)

## See Also

### Combining keystrokes

- [typeKey(_:modifierFlags:)](xcuiautomation/xcuielement/typekey(_:modifierflags:)-6gaoi.md)
- [typeKey(_:modifierFlags:)](xcuiautomation/xcuielement/typekey(_:modifierflags:)-9ubn.md)
- [XCUIKeyboardKey](xcuiautomation/xcuikeyboardkey.md)
- [perform(withKeyModifiers:block:)](xcuiautomation/xcuielement/perform(withkeymodifiers:block:).md)
