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

# init(code:userActivity:)

Creates a response object with the specified code and user activity.

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

## Parameters

`code`

The response code that indicates success or failure when confirming or handling the intent. For a list of possible values, see [`INListCarsIntentResponseCode`](/documentation/Intents/INListCarsIntentResponseCode).

`userActivity`

A user activity that the system passes to your app if it launches as a result of this response. Use an activity if you need to provide additional information specific to your app.

    If you specify     `nil`    , the system automatically:

- Creates a user activity for you.
- Sets the activity’s type to the class name of the intent it’s handling.
- Sets the activity’s <doc://com.apple.documentation/documentation/Foundation/NSUserActivity/interaction> property to an instance of [`INInteraction`](/documentation/Intents/INInteraction) that contains the intent and your response.

---

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)