<!--
{
  "availability" : [
    "iOS: 10.3.0 -",
    "iPadOS: 10.3.0 -",
    "watchOS: 3.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SiriKit",
  "identifier" : "/documentation/Intents/INSetCarLockStatusIntent/init(locked:carName:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Intents"
    ],
    "preciseIdentifier" : "s:So24INSetCarLockStatusIntentC7IntentsE6locked7carNameABSbSg_So17INSpeakableStringCSgtcfc"
  },
  "title" : "init(locked:carName:)"
}
-->

# init(locked:carName:)

Initializes an intent to set the lock status of the named car.

```
@nonobjc convenience init(locked: Bool?, carName: INSpeakableString?)
```

## Parameters

`locked`

A Boolean value that indicates whether the car should be locked (<doc://com.apple.documentation/documentation/Swift/true>) or unlocked (<doc://com.apple.documentation/documentation/Swift/false>).

`carName`

A name that identifies the user’s car. If `nil`, the intent is instantiated with a [`carName`](/documentation/Intents/INSetCarLockStatusIntent/carName) property containing the string `myCar`.

## Return Value

A newly initialized `INSetCarLockStatusIntent` object.

## Discussion

Normally, you do not create instances of this class yourself. Instead, Siri creates instances when the user asks it to lock or unlock the car. However, you can use this method during testing to create intent objects to validate your intent-handling code paths.

---

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)