---
title: "imageURL(forTraits:)"
framework: tvservices
role: symbol
role_heading: Instance Method
path: "tvservices/tvcontentitem/imageurl(fortraits:)"
---

# imageURL(forTraits:)

Retrieve the URL for the image that best matches the specified traits.

## Declaration

```swift
func imageURL(forTraits traits: TVContentItemImageTrait) -> URL?
```

## Parameters

- `traits`: The traits for the image you want. For example, you might ask specifically for the variant of the image that supports a dark interface.

## Return Value

Return Value The URL for the image asset, or nil if an image with the specified traits was not found.

## Discussion

Discussion The image URL can be an absolute path on the local device or an HTTP path. The preferred file format for this image is a layered image file that provides the proper 3d effects. For more information, see App Programming Guide for tvOS.

## See Also

### Accessing Image Resources

- [imageURL](tvservices/tvcontentitem/imageurl.md)
- [setImageURL(_:forTraits:)](tvservices/tvcontentitem/setimageurl(_:fortraits:).md)
- [TVContentItemImageTrait](tvservices/tvcontentitemimagetrait.md)
