<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: -",
    "tvOS: 17.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIMutableTraits-13ja5",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit15UIMutableTraitsP"
  },
  "title" : "UIMutableTraits"
}
-->

# UIMutableTraits

A mutable container of traits.

```
protocol UIMutableTraits
```

## Overview

The [`UIMutableTraits`](/documentation/UIKit/UIMutableTraits-13ja5) protocol provides read-write access to get and set trait values on an underlying container. UIKit uses this protocol to facilitate working with instances of [`UITraitCollection`](/documentation/UIKit/UITraitCollection), which are immutable and read-only. The [`UITraitCollection`](/documentation/UIKit/UITraitCollection) initializer [`init(mutations:)`](/documentation/UIKit/UITraitCollection/init(mutations:)) uses an instance of [`UIMutableTraits`](/documentation/UIKit/UIMutableTraits-13ja5), which enables you to set a batch of trait values in one method call. [`UITraitOverrides`](/documentation/UIKit/UITraitOverrides-swift.struct) conforms to [`UIMutableTraits`](/documentation/UIKit/UIMutableTraits-13ja5), making it easy to set trait overrides on trait environments such as views and view controllers.

When you define a custom trait, declare a property for the trait in an extension to [`UIMutableTraits`](/documentation/UIKit/UIMutableTraits-13ja5) so that you can access your custom trait using standard property syntax.

The following example defines an extension and sets the theme on the [`traitOverrides`](/documentation/UIKit/UIView/traitOverrides-fd9z) property:

```swift
// ThemeTrait conforms to UITraitDefinition, and has a defaultValue type of Theme
extension UIMutableTraits {
    var theme: Theme {
        get { self[ThemeTrait.self] }
        set { self[ThemeTrait.self] = newValue }
    }
}

// Apply an override for the custom theme trait.
view.traitOverrides.theme = .monochrome
```

## Topics

### Getting and setting trait values

[`accessibilityContrast`](/documentation/UIKit/UIMutableTraits-13ja5/accessibilityContrast)

The accessibility contrast associated with the current environment.

[`activeAppearance`](/documentation/UIKit/UIMutableTraits-13ja5/activeAppearance)

A property that indicates whether the user interface has an active appearance.

[`displayGamut`](/documentation/UIKit/UIMutableTraits-13ja5/displayGamut)

The gamut of the current display.

[`displayScale`](/documentation/UIKit/UIMutableTraits-13ja5/displayScale)

The display scale of the trait collection.

[`forceTouchCapability`](/documentation/UIKit/UIMutableTraits-13ja5/forceTouchCapability)

The Force Touch capability value of the trait collection.

[`headroomUsageLimit`](/documentation/UIKit/UIMutableTraits-13ja5/headroomUsageLimit)

The HDR headroom usage limit associated with the current environment.

[`horizontalSizeClass`](/documentation/UIKit/UIMutableTraits-13ja5/horizontalSizeClass)

The horizontal size class of the trait collection.

[`imageDynamicRange`](/documentation/UIKit/UIMutableTraits-13ja5/imageDynamicRange)

The image dynamic range associated with the current environment.

[`layoutDirection`](/documentation/UIKit/UIMutableTraits-13ja5/layoutDirection)

The layout direction associated with the current environment.

[`legibilityWeight`](/documentation/UIKit/UIMutableTraits-13ja5/legibilityWeight)

The font weight to apply to text.

[`listEnvironment`](/documentation/UIKit/UIMutableTraits-13ja5/listEnvironment)

The style of the containing list in a collection view or table view.

[`preferredContentSizeCategory`](/documentation/UIKit/UIMutableTraits-13ja5/preferredContentSizeCategory)

The font sizing option preferred by the user.

[`resolvesNaturalAlignmentWithBaseWritingDirection`](/documentation/UIKit/UIMutableTraits-13ja5/resolvesNaturalAlignmentWithBaseWritingDirection)

The setting for whether the system resolves natural alignment with base writing direction for the current environment.

[`sceneCaptureState`](/documentation/UIKit/UIMutableTraits-13ja5/sceneCaptureState)

The scene capture state for the current environment.

[`splitViewControllerLayoutEnvironment`](/documentation/UIKit/UIMutableTraits-13ja5/splitViewControllerLayoutEnvironment)

The split view controller layout for the current environment.

[`tabAccessoryEnvironment`](/documentation/UIKit/UIMutableTraits-13ja5/tabAccessoryEnvironment)

The tab accessory environment for the current trait collection.

[`toolbarItemPresentationSize`](/documentation/UIKit/UIMutableTraits-13ja5/toolbarItemPresentationSize)

The presentation size of a toolbar item in an AppKit toolbar.

[`typesettingLanguage`](/documentation/UIKit/UIMutableTraits-13ja5/typesettingLanguage)

The typesetting language associated with the current environment.

[`userInterfaceIdiom`](/documentation/UIKit/UIMutableTraits-13ja5/userInterfaceIdiom)

The user interface idiom of the trait collection.

[`userInterfaceLevel`](/documentation/UIKit/UIMutableTraits-13ja5/userInterfaceLevel)

The elevation level of the interface.

[`userInterfaceStyle`](/documentation/UIKit/UIMutableTraits-13ja5/userInterfaceStyle)

The style associated with the user interface.

[`verticalSizeClass`](/documentation/UIKit/UIMutableTraits-13ja5/verticalSizeClass)

The vertical size class of the trait collection.

## See Also

[`init(mutations:)`](/documentation/UIKit/UITraitCollection/init(mutations:))

[`modifyingTraits(_:)`](/documentation/UIKit/UITraitCollection/modifyingTraits(_:))



---

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)