<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SiriKit",
  "identifier" : "/documentation/Intents/INUpdateMediaAffinityIntent/init(mediaItems:mediaSearch:affinityType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Intents"
    ],
    "preciseIdentifier" : "c:objc(cs)INUpdateMediaAffinityIntent(im)initWithMediaItems:mediaSearch:affinityType:"
  },
  "title" : "init(mediaItems:mediaSearch:affinityType:)"
}
-->

# init(mediaItems:mediaSearch:affinityType:)

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

```
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

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

## Discussion

The [`INUpdateMediaAffinityIntent`](/documentation/Intents/INUpdateMediaAffinityIntent) object should include information about the media that accurately represents the content and where to find it.

---

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)