<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSScriptCoercionHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSScriptCoercionHandler"
  },
  "title" : "NSScriptCoercionHandler"
}
-->

# NSScriptCoercionHandler

A mechanism for converting one kind of scripting data to another.

```
class NSScriptCoercionHandler
```

## Overview

A shared instance of this class coerces (converts) object values to objects of another class using information supplied by classes that register with it. Coercions frequently are required during key-value coding.

## Topics

### Accessing the application’s handler

[`+  sharedCoercionHandler`](/documentation/Foundation/NSScriptCoercionHandler/shared())

Returns the shared `NSScriptCoercionHandler` for the application.

### Working with handlers

[`-  coerceValue:toClass:`](/documentation/Foundation/NSScriptCoercionHandler/coerceValue(_:to:))

Returns an object of a given class representing a given value.

[`-  registerCoercer:selector:toConvertFromClass:toClass:`](/documentation/Foundation/NSScriptCoercionHandler/registerCoercer(_:selector:toConvertFrom:to:))

Registers a given object (typically a class) to handle coercions (conversions) from one given class to another.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)