---
title: Traits and the trait environment
framework: uikit
role: collectionGroup
role_heading: API Collection
path: uikit/traits-and-the-trait-environment
---

# Traits and the trait environment

Get information about traits and the environment in which your app runs, and share data with your view hierarchy.

## Overview

Overview Traits represent independent pieces of data that UIKit automatically distributes through your app’s view and view controller hierarchies. The trait system provides a unified way to share configuration information, making it easier to build adaptive interfaces that respond to changes in device orientation, appearance modes, accessibility settings, and custom app states. The trait system propagates values from the top of the hierarchy downward. When you modify a trait at any level using trait overrides, that change affects the modified object and all of its descendants. Setting a trait override on a window scene affects all view controllers and views within that scene. Setting a trait override on a specific view affects only that view and its subviews. Use custom traits to propagate data that needs to flow through these parts of your view hierarchy: Window scene (UIWindowScene) Window (UIWindow) Presentation controller (UIPresentationController) View controller (UIViewController) View (UIView) Subview (UIView) Custom traits are particularly useful for: Configuration settings that affect entire sections of your interface Appearance states that need to cascade through view hierarchies Custom app themes or styling modes Feature flags that enable or disable UI elements Avoid using custom traits in cases where you can directly set properties on a view controller, view, or subview.

## Topics

### Essentials

- [Adapting your app when traits change](uikit/adapting-your-app-when-traits-change.md)

### Observing and managing traits

- [Automatic trait tracking](uikit/automatic-trait-tracking.md)
- [UITraitCollection](uikit/uitraitcollection.md)
- [UITraitEnvironment](uikit/uitraitenvironment.md)
- [UITraitChangeObservable](uikit/uitraitchangeobservable-67e94.md)
- [UIMutableTraits](uikit/uimutabletraits-13ja5.md)
- [UIAdaptivePresentationControllerDelegate](uikit/uiadaptivepresentationcontrollerdelegate.md)
- [UIContentContainer](uikit/uicontentcontainer.md)

### 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)
- [UITrait](uikit/uitrait-9423.md)
- [UITraitDefinition](uikit/uitraitdefinition-64c15.md)

## See Also

### Adaptivity and traits

- [Responding to changing display modes on Apple TV](uikit/responding-to-changing-display-modes-on-apple-tv.md)
