---
title: "register(_:with:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiimageasset/register(_:with:)-2plm5"
---

# register(_:with:)

Registers an image with the specified trait collection.

## Declaration

```swift
func register(_ image: UIImage, with traitCollection: UITraitCollection)
```

## Parameters

- `image`: The image you want to register with the image asset.
- `traitCollection`: The traits to associate with image.

## Discussion

Discussion Each image in an image asset must have a unique set of traits. If the asset already contains a registered image with the equivalent traits, it replaces that image with the one in the image parameter. important: The trait collection must always contain an explicit value in its displayScale property. You may experience unexpected results from image(with:) if the trait collection doesn’t explicitly define the desired scale.

## See Also

### Registering and unregistering images

- [register(_:with:)](uikit/uiimageasset/register(_:with:)-89c5b.md)
- [unregister(imageWith:)](uikit/uiimageasset/unregister(imagewith:).md)
- [unregisterImage(with:)](uikit/uiimageasset/unregisterimage(with:).md)
