---
title: traitCollection
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uitraitenvironment/traitcollection
---

# traitCollection

The traits, such as the size class and scale factor, that describe the current environment of the object.

## Declaration

```swift
var traitCollection: UITraitCollection { get }
```

## Mentioned in

Displaying and managing views with a view controller

## Discussion

Discussion UIViewController and UIView adopt the UITraitEnvironment protocol and expose this property. important: Don’t implement this property in your own objects. Instead, use the traitCollection property associated with a view, view controller, or other object to determine the currently available trait information.
