---
title: XCTKVOExpectation.Handler
framework: xctest
role: symbol
role_heading: Type Alias
path: xctest/xctkvoexpectation/handler-swift.typealias
---

# XCTKVOExpectation.Handler

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

## Declaration

```swift
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

Return Value Your custom handler returns true if the system fulfills the expectation after the observed change; otherwise, false.

## See Also

### Custom KVO evaluation

- [handler](xctest/xctkvoexpectation/handler-swift.property.md)
