NSScriptKeyValueCoding

A collection of methods that provide additional capabilities for working with key-value coding.

Overview

Cocoa scripting takes advantage of key-value coding to get and set information in scriptable objects. The methods in this category provide additional capabilities for working with key-value coding, including getting and setting key values by index in multi-value keys and coercing (or converting) a key value. Additional methods allow the implementer of a scriptable container class to provide fast access to elements that are being referenced by name and unique ID.

Because Cocoa scripting invokes setValue:forKey: and mutableArrayValueForKey:, changes to model objects made by AppleScript scripts are observable using automatic key-value observing.

Topics

Indexed access

- insertValue:atIndex:inPropertyWithKey:

Inserts an object at the specified index in the collection specified by the passed key.

- removeValueAtIndex:fromPropertyWithKey:

Removes the object at the specified index from the collection specified by the passed key.

- replaceValueAtIndex:inPropertyWithKey:withValue:

Replaces the object at the specified index in the collection specified by the passed key.

- valueAtIndex:inPropertyWithKey:

Retrieves an indexed object from the collection specified by the passed key.

Access by name, key, or ID

- insertValue:inPropertyWithKey:

Inserts an object in the collection specified by the passed key.

- valueWithName:inPropertyWithKey:

Retrieves a named object from the collection specified by the passed key.

- valueWithUniqueID:inPropertyWithKey:

Retrieves an object by ID from the collection specified by the passed key.

Coercion

- coerceValue:forKey:

Uses type info from the class description and NSScriptCoercionHandler to attempt to convert value for key to the proper type, if necessary.

Constants

NSScriptKeyValueCoding Exception Names

Exceptions raised by key-value coding methods.

See Also

NSObject Script Support

NSComparisonMethods

A collection of default comparison methods useful for performing specifier tests.

NSScriptingComparisonMethods

A collection of methods useful for comparing script objects.

NSScriptObjectSpecifiers

A collection of methods providing additional object specifier functionality.

NSScriptCoercionHandler

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

NSScriptExecutionContext

The context in which the current script command is executed.