A configuration object containing the traits that the system used when selecting the current image variant.
- iOS 13.0+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
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 objects are immutable and you don't create them directly. Instead, get an existing image configuration object from a
UIImage object. To add attributes to your configuration object, use the
configuration method to create a new object that merges the existing object's values with new values you supply. Assign the new object to the
preferred property of the
UIImage object you use to display the image. If you draw the image directly, use the
image method to create a new image that contains the new attributes.