<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTKVOExpectation/Handler-swift.typealias",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "c:@T@XCKeyValueObservingExpectationHandler"
  },
  "title" : "XCTKVOExpectation.Handler"
}
-->

# XCTKVOExpectation.Handler

A custom handler to call when observing a KVO change for a specified key path.

```
typealias Handler = @Sendable (Any, [AnyHashable : Any]) -> Bool
```

## Parameters

`observedObject`

The observed object, which helps to avoid block-capture issues.

`change`

The KVO change dictionary.

## Return Value

Your custom handler returns <doc://com.apple.documentation/documentation/Swift/true> if the system fulfills the expectation after the observed change; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## 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)