<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIImage/Configuration-swift.class",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIImageConfiguration"
  },
  "title" : "UIImage.Configuration"
}
-->

# UIImage.Configuration

A configuration object that contains the traits that the system uses when selecting the current image variant.

```
class Configuration
```

## Overview

Images may contain multiple variants to account for environmental factors, such as whether the interface is light or dark. The image configuration object lets you override the current environment and render an image with specific attributes. For example, you might want to render a specific version of your image to your interface.

[`UIImage.Configuration`](/documentation/UIKit/UIImage/Configuration-swift.class) objects are immutable and you don’t create them directly. Instead, get an existing image configuration object from a [`UITraitCollection`](/documentation/UIKit/UITraitCollection) or [`UIImage`](/documentation/UIKit/UIImage) object. To add attributes to your configuration object, use the [`applying(_:)`](/documentation/UIKit/UIImage/Configuration-swift.class/applying(_:)) method to create a new object that merges the existing object’s values with new values you supply. Assign the new object to the [`preferredSymbolConfiguration`](/documentation/UIKit/UIImageView/preferredSymbolConfiguration) property of the [`UIImageView`](/documentation/UIKit/UIImageView) object you use to display the image. If you draw the image directly, use the [`withConfiguration(_:)`](/documentation/UIKit/UIImage/withConfiguration(_:)) method to create a new image that contains the new attributes.

## Topics

### Modifying a configuration object

[`applying(_:)`](/documentation/UIKit/UIImage/Configuration-swift.class/applying(_:))

Returns a configuration object that applies the specified configuration values on top of the current object’s values.

[`withTraitCollection(_:)`](/documentation/UIKit/UIImage/Configuration-swift.class/withTraitCollection(_:))

Returns a new configuration object that merges the current traits with the traits from the specified trait collection.

### Getting the configuration traits

[`traitCollection`](/documentation/UIKit/UIImage/Configuration-swift.class/traitCollection)

The traits associated with the image configuration.



---

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)