<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: -",
    "tvOS: 17.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITrait-9423",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit7UITraita"
  },
  "title" : "UITrait"
}
-->

# UITrait

A type representing a trait in a trait collection.

```
typealias UITrait = any UITraitDefinition.Type
```

## Discussion

The type of a trait serves as a key to uniquely identify a trait in a trait collection. The [`subscript(_:)`](/documentation/UIKit/UITraitCollection/subscript(_:)-96v58) method of [`UITraitCollection`](/documentation/UIKit/UITraitCollection) and [`registerForTraitChanges(_:handler:)`](/documentation/UIKit/UITraitChangeObservable-67e94/registerForTraitChanges(_:handler:)) are two examples that take trait types to identify traits in the collection.

---

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)