<!--
{
  "availability" : [
    "Xcode: 16.3.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "swift: 4.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "XCUIAutomation",
  "identifier" : "/documentation/XCUIAutomation/XCUIElement/typeKey(_:modifierFlags:)-6gaoi",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "XCUIAutomation"
    ],
    "preciseIdentifier" : "s:So11XCUIElementC14XCUIAutomationE7typeKey_13modifierFlagsySo012XCUIKeyboardD0a_So015XCUIKeyModifierF0VtF"
  },
  "title" : "typeKey(_:modifierFlags:)"
}
-->

# typeKey(_:modifierFlags:)

Types a single key from the XCUIKeyboardKey enumeration with the specified modifier flags.

```
@MainActor @nonobjc @preconcurrency func typeKey(_ key: XCUIKeyboardKey, modifierFlags: XCUIElement.KeyModifierFlags)
```

---

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)