<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "tvOS: 14.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIConfigurationState-8d7pd",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit20UIConfigurationStateP"
  },
  "title" : "UIConfigurationState"
}
-->

# UIConfigurationState

The requirements for an object that encapsulates a view’s state.

```
protocol UIConfigurationState
```

## Overview

This protocol provides a blueprint for a configuration state object, which encompasses a trait collection along with all of the common states that affect a view’s appearance. A configuration state encapsulates the inputs that configure a view for any possible state or combination of states. You use a configuration state with background and content configurations to obtain the default appearance for a specific state.

Typically, you don’t create a configuration state yourself. To obtain a configuration state, override the [`updateConfiguration(using:)`](/documentation/UIKit/UICollectionViewCell/updateConfiguration(using:)) method in your view subclass and use the state parameter. Outside of this method, you can get a view’s configuration state by using its [`configurationState`](/documentation/UIKit/UICollectionViewCell/configurationState-4u37h) property.

For more information, see [`UIViewConfigurationState`](/documentation/UIKit/UIViewConfigurationState-swift.struct) and [`UICellConfigurationState`](/documentation/UIKit/UICellConfigurationState-swift.struct).

## Topics

### Managing configuration states

[`var traitCollection: UITraitCollection`](/documentation/UIKit/UIConfigurationState-8d7pd/traitCollection)

The traits that describe the current layout environment of the view, such as the user interface style and layout direction.

[`subscript(UIConfigurationStateCustomKey) -> AnyHashable?`](/documentation/UIKit/UIConfigurationState-8d7pd/subscript(_:))

Accesses custom states by key.

### Creating a configuration state manually

[`init(traitCollection: UITraitCollection)`](/documentation/UIKit/UIConfigurationState-8d7pd/init(traitCollection:))

Creates a view configuration state with the specified trait collection.

## Relationships

### Conforming Types

[`UIContentUnavailableConfigurationState-swift.struct`](/documentation/UIKit/UIContentUnavailableConfigurationState-swift.struct)

[`UIViewConfigurationState-swift.struct`](/documentation/UIKit/UIViewConfigurationState-swift.struct)

[`UICellConfigurationState-swift.struct`](/documentation/UIKit/UICellConfigurationState-swift.struct)

---

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)