<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSExpression/expressionValue(with:context:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSExpression(im)expressionValueWithObject:context:"
  },
  "title" : "expressionValue(with:context:)"
}
-->

# expressionValue(with:context:)

Evaluates an expression using a specified object and context.

```
func expressionValue(with object: Any?, context: NSMutableDictionary?) -> Any?
```

## Parameters

`object`

The object against which the expression is evaluated.

`context`

A dictionary that the expression can use to store temporary state for one predicate evaluation. Can be `nil`.

    Note that     `context`     is mutable, and that it can only be accessed during the evaluation of the expression. You must not attempt to retain it for use elsewhere.

## Return Value

The evaluated object.

## Discussion

---

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)