<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSAccessibility-swift.struct/Role/description(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:@F@NSAccessibilityRoleDescriptionForUIElement"
  },
  "title" : "description(for:)"
}
-->

# description(for:)

Returns a standard role description for a user interface element.

```
static func description(for element: Any) -> String?
```

## Discussion

This function is like the [`description(with:)`](/documentation/AppKit/NSAccessibility-swift.struct/Role/description(with:)) function, except that it queries `element` to get the role and subrole. The [`description(with:)`](/documentation/AppKit/NSAccessibility-swift.struct/Role/description(with:)) function is more efficient, but this function is useful for accessorizing base classes so that they properly handle derived classes, which may override the subrole or even the role.

---

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)