<!--
{
  "availability" : [

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

# XCTNSPredicateExpectation.Handler

A handler XCTest calls when evaluating the predicate returns `true`.

```
typealias Handler = @Sendable () -> Bool
```

## Return Value

Your custom handler should return <doc://com.apple.documentation/documentation/Swift/true> if the expectation is considered fulfilled, 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)