---
title: "containsTraits(in:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitraitcollection/containstraits(in:)"
---

# containsTraits(in:)

Queries whether a trait collection contains all of another trait collection’s values.

## Declaration

```swift
func containsTraits(in trait: UITraitCollection?) -> Bool
```

## Parameters

- `trait`: A trait collection that you want to compare to the current trait collection.

## Return Value

Return Value This method returns true if the receiver contains all of the trait values in the trait collection passed in the trait parameter, and returns false otherwise.

## Discussion

Discussion Use this method to compare two standalone trait collections, or to compare the iOS interface environment’s trait collection to a standalone trait collection.

## See Also

### Comparing trait collections

- [hasDifferentColorAppearance(comparedTo:)](uikit/uitraitcollection/hasdifferentcolorappearance(comparedto:).md)
