Creates and returns one or more scripting objects to be inserted into the specified relationship by copying the passed-in value and setting the properties in the copied object or objects.
- macOS 10.5+
An object or objects to be copied. The type must match the type of the property identified by
key. (See also the Discussion section.)
For example, if the property is a to-many relationship,
valuewill always be an array of objects to be copied, and this method must therefore return an array of objects.
A key that identifies the relationship into which to insert the copied object or objects.
The properties to be set in the copied object or objects. Derived from the "with properties" parameter of a
duplicatecommand. (See also the Discussion section.)
The copied object or objects. Returns
nil if an error occurs.
You can override the
copy method to take more control when your application is sent a
duplicate command. This method is invoked on the prospective container of the copied object or objects. The
properties are derived from the
with properties parameter of the
duplicate command. The returned objects or objects are then inserted into the container using key-value coding.
When this method is invoked by Cocoa, neither the value nor the properties will have yet been coerced using the
coerce. For sdef-declared scriptability, however, the types of the passed-in objects reliably match the relevant sdef declarations.
The default implementation of this method copies scripting objects by sending
copy to the object or objects specified by
value. You override this method for situations where this is not sufficient, such as in Core Data applications, in which new objects must be initialized with