<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SiriKit",
  "identifier" : "/documentation/Intents/INPlayMediaIntentResponse/init(code:userActivity:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Intents"
    ],
    "preciseIdentifier" : "c:objc(cs)INPlayMediaIntentResponse(im)initWithCode:userActivity:"
  },
  "title" : "init(code:userActivity:)"
}
-->

# init(code:userActivity:)

Creates a response for a play media intent.

```
init(code: INPlayMediaIntentResponseCode, userActivity: NSUserActivity?)
```

## Parameters

`code`

A response code that indicates whether the app can play the media.

`userActivity`

A user activity that contains private state data that your Intents app extension shares with your main app.

---

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)