<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SiriKit",
  "identifier" : "/documentation/Intents/INParameter/index(forSubKeyPath:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Intents"
    ],
    "preciseIdentifier" : "c:objc(cs)INParameter(im)indexForSubKeyPath:"
  },
  "title" : "index(forSubKeyPath:)"
}
-->

# index(forSubKeyPath:)

The index into the array at the specified portion of the key path.

```
func index(forSubKeyPath subKeyPath: String) -> Int
```

## Parameters

`subKeyPath`

The key path to a property containing an array or ordered set. For example, when retrieving a message from a set of search results, specify the string `messages`.

## Return Value

The index of the item in the array.

## Discussion

For intents or responses that contain an array of values, use this method to determine which object in the array was specified. For example, if a parameter represented the first object in an array of messages returned by a search, specifying the string `messages` would return the value `0`.

---

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)