---
title: "init(for:keyPath:)"
framework: intents
role: symbol
role_heading: Initializer
path: "intents/inparameter/init(for:keypath:)"
---

# init(for:keyPath:)

Creates a new parameter object using the specified key path and class information.

## Declaration

```swift
convenience init(for aClass: AnyClass, keyPath: String)
```

## Parameters

- `aClass`: The intent or intent response class that contains the specified key path. For example, when specifying properties of a ride request intent, you would specify the doc://com.apple.sirikit/documentation/Intents/INRequestRideIntent class.
- `keyPath`: The path to a property of the specified class. For example, to specify the key path for the doc://com.apple.sirikit/documentation/Intents/INRequestRideIntent/pickupLocation property of a ride request, specify the string pickupLocation.

## Return Value

Return Value An initialized parameter object.

## Discussion

Discussion If any properties in the key path contain an array or ordered set, use the setIndex(_:forSubKeyPath:) method to specify which object in those properties to use.

## See Also

### Creating a Parameter Object

- [init(keyPath:)](intents/inparameter/init(keypath:).md)
