---
title: "init(locked:carName:)"
framework: intents
role: symbol
role_heading: Initializer
path: "intents/insetcarlockstatusintent/init(locked:carname:)"
---

# init(locked:carName:)

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

## Declaration

```swift
@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 doc://com.apple.sirikit/documentation/Intents/INSetCarLockStatusIntent/carName property containing the string myCar.

## Return Value

Return Value A newly initialized INSetCarLockStatusIntent object.

## Discussion

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.
