---
title: "init(mediaItems:mediaSearch:affinityType:)"
framework: intents
role: symbol
role_heading: Initializer
path: "intents/inupdatemediaaffinityintent/init(mediaitems:mediasearch:affinitytype:)"
---

# init(mediaItems:mediaSearch:affinityType:)

Creates an intent that describes the media items, their location, and the affinity to update.

## Declaration

```swift
init(mediaItems: [INMediaItem]?, mediaSearch: INMediaSearch?, affinityType: INMediaAffinityType)
```

## Parameters

- `mediaItems`: The media content, such as a song or TV show, the user is playing. When donating the intent, the system uses only the first item in the array, ignoring the other media items in the array.
- `mediaSearch`: The location in which to search for a media item.
- `affinityType`: The user’s preference for the media item.

## Return Value

Return Value An initialized intent object or nil if the object could not be created.

## Discussion

Discussion The INUpdateMediaAffinityIntent object should include information about the media that accurately represents the content and where to find it.
