<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSIndexSpecifier/init(containerClassDescription:containerSpecifier:key:index:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSIndexSpecifier(im)initWithContainerClassDescription:containerSpecifier:key:index:"
  },
  "title" : "init(containerClassDescription:containerSpecifier:key:index:)"
}
-->

# init(containerClassDescription:containerSpecifier:key:index:)

Initializes an allocated [`NSIndexSpecifier`](/documentation/Foundation/NSIndexSpecifier) object with a class description, container specifier, collection key, and object index.

```
init(containerClassDescription classDesc: NSScriptClassDescription, containerSpecifier container: NSScriptObjectSpecifier?, key property: String, index: Int)
```

## Parameters

`classDesc`

Description for the container of the collection.

`container`

Container of the collection.

`property`

Name of the collection.

`index`

The object within the `key` collection the index specifier is to identify.

## Return Value

Initialized [`NSIndexSpecifier`](/documentation/Foundation/NSIndexSpecifier) object with its `index` property set to `objectIndex`.

## Discussion

Invokes the super class’s [`init(containerClassDescription:containerSpecifier:key:)`](/documentation/Foundation/NSScriptObjectSpecifier/init(containerClassDescription:containerSpecifier:key:)) method and sets the `index` property of the index specifier to `objectIndex`.

## See Also

  [Cocoa Scripting Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_intro/SAppsIntro.html#//apple_ref/doc/uid/TP40002164)



---

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)