<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAssertionHandlerKey",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@NSAssertionHandlerKey"
  },
  "title" : "NSAssertionHandlerKey"
}
-->

# NSAssertionHandlerKey

A key with a corresponding value in the thread dictionary.

```
let NSAssertionHandlerKey: String
```

## Discussion

If you need to customize the behavior of `NSAssertionHandler`, create a subclass, overriding [`handleFailureInMethod:object:file:lineNumber:description:`](/documentation/Foundation/NSAssertionHandler/handleFailureInMethod:object:file:lineNumber:description:) and [`handleFailureInFunction:file:lineNumber:description:`](/documentation/Foundation/NSAssertionHandler/handleFailureInFunction:file:lineNumber:description:), and install your instance into the current thread’s attributes dictionary with this key.

---

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)