<!--
{
  "availability" : [
    "*: -",
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "tvOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTKeyPathExpectation/Predicate",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "s:6XCTest21XCTKeyPathExpectationC9Predicatea"
  },
  "title" : "XCTKeyPathExpectation.Predicate"
}
-->

# XCTKeyPathExpectation.Predicate

A function the key path expectation uses to test the value of an observed property.

```
typealias Predicate = @Sendable (T, NSKeyValueObservedChange<V>) async -> Bool
```

## Parameters

`observedObject`

The observed object to evaluate with the property that changes.

`change`

A value that describes the observed change.

## Return Value

Returns <doc://com.apple.documentation/documentation/Swift/true> if the change fulfills the expectation; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

A key path expectation uses this function to determine whether the value of the observed property fulfills the conditions of the expectation. The system invokes the function asyncronously on a detached task and may call the function more that once.

---

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)