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

# objectsByEvaluating(withContainers:)

Returns the actual object or objects specified by the receiver as evaluated in the context of given container object.

```
func objectsByEvaluating(withContainers containers: Any) -> Any?
```

## Return Value

The actual object or objects specified by the receiver as evaluated in the context of its container object or objects (`containers`).

## Discussion

Invokes [`indicesOfObjectsByEvaluating(withContainer:count:)`](/documentation/Foundation/NSScriptObjectSpecifier/indicesOfObjectsByEvaluating(withContainer:count:)) on `self` to get an array of pointers to indices of elements in `containers` that have values paired with the message receiver’s key. This method then uses key-value coding to obtain the object or objects associated with the key; it returns these objects or `nil` if there are no matching values in containers. If there are multiple matching values, they are returned in an `NSArray`; if matching values are `nil`, `NSNull` objects are substituted. If `containers` is an `NSArray`, the method recursively evaluates each element in the array and returns an `NSArray` with evaluated objects (including `NSNulls`) in their corresponding slots.

---

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)