<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSScriptObjectSpecifier/indicesOfObjectsByEvaluating(withContainer:count:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSScriptObjectSpecifier(im)indicesOfObjectsByEvaluatingWithContainer:count:"
  },
  "title" : "indicesOfObjectsByEvaluating(withContainer:count:)"
}
-->

# indicesOfObjectsByEvaluating(withContainer:count:)

This primitive method must be overridden by subclasses to return a pointer to an array of indices identifying objects in the key of a given container that are identified by the receiver of the message.

```
func indicesOfObjectsByEvaluating(withContainer container: Any, count: UnsafeMutablePointer<Int>) -> UnsafeMutablePointer<Int>?
```

## Discussion

This primitive method must be overridden by subclasses to return a pointer to an array of indices identifying objects in the key of the container `aContainer` that are identified by the receiver of the message. The method uses key-value coding to obtain values based on the receiver’s key. It returns the number of such matching objects by indirection in `numRefs`. It returns `nil` directly and –1 via `numRefs` if all objects in the container (or the sole object) match the value of the receiver’s key. This method is invoked by [`objectsByEvaluating(withContainers:)`](/documentation/Foundation/NSScriptObjectSpecifier/objectsByEvaluating(withContainers:)). The default implementation returns `nil` directly and –1 indirectly via `numRefs`.

---

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)