<!--
{
  "availability" : [

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

# XCTNSNotificationExpectation.Handler

A custom handler to be called when a matching notification is received.

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

## Parameters

`notification`

The notification object.

## Return Value

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