NSScriptCoercionHandler Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSScriptCoercionHandler.h |
Overview
Provides a mechanism for converting one kind of scripting data to another. 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.
Class Methods
sharedCoercionHandler
Returns the shared NSScriptCoercionHandler for the application.
Return Value
The shared NSScriptCoercionHandler for the application.
Availability
- Available in OS X v10.0 and later.
Declared In
NSScriptCoercionHandler.hInstance Methods
coerceValue:toClass:
Returns an object of a given class representing a given value.
Parameters
- value
The value to coerce.
- toClass
The class with which to represent value.
Return Value
An object of the class toClass representing the value specified by value. Returns nil if an error occurs.
Availability
- Available in OS X v10.0 and later.
Declared In
NSScriptCoercionHandler.hregisterCoercer:selector:toConvertFromClass:toClass:
Registers a given object (typically a class) to handle coercions (conversions) from one given class to another.
Parameters
- coercer
The object that performs the coercion. coercer should typically be a class object.
- selector
A selector that specifies the method to perform the coercion. selector should typically be a factory method, and must take two arguments. The first is the value to be converted. The second is the class to convert it to.
- fromClass
The class for which instances are coerced.
- toClass
The class to which instances of fromClass are coerced.
Availability
- Available in OS X v10.0 and later.
Declared In
NSScriptCoercionHandler.h© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)