---
title: UITrait
framework: uikit
role: symbol
role_heading: Type Alias
path: uikit/uitrait-9423
---

# UITrait

A type representing a trait in a trait collection.

## Declaration

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

## Discussion

Discussion The type of a trait serves as a key to uniquely identify a trait in a trait collection. The subscript(_:) method of UITraitCollection and registerForTraitChanges(_:handler:) are two examples that take trait types to identify traits in the collection.

## See Also

### Custom traits

- [Providing data to the view hierarchy with custom traits](uikit/providing-data-to-the-view-hierarchy-with-custom-traits.md)
- [UIMutableTraits](uikit/uimutabletraits-13ja5.md)
- [UITraitDefinition](uikit/uitraitdefinition-64c15.md)
