A specifier for an object in a collection (or container) by unique ID.
- macOS 10.2+
This specifier works only for objects that have an ID property. The unique ID object passed to an instance of
NSUnique must be either an
NSNumber object or an
NSString object. The exact type should match the scripting dictionary declaration of the ID attribute for the relevant scripting class.
You can expect that the ID property will be read only for any object that supports it. Therefore a scripter can obtain the unique ID for an object and refer to the object by the ID, but cannot set the unique ID.
You don’t normally subclass
The evaluation of
NSUnique objects follows these steps until the specified object is found:
If the container implements a method whose selector matches the relevant
valuepattern established by scripting key-value coding, the method is invoked. This method can potentially be very fast, and it may be relatively easy to implement.
In<Key>With Unique ID:
As is the case when evaluating any script object specifier, the container of the specified object is given a chance to evaluate the object specifier. If the container class implements the
indicesmethod, the method is invoked. This method can potentially be very fast, but it is relatively difficult to implement.
Of Objects(by Evaluating Object Specifier:)
NSWhoseobject that specifies the first object whose relevant
'ID 'attribute matches the ID is synthesized and evaluated. The
NSWhoseobject must search through all of the keyed elements in the container, looking for a match. The search is potentially very slow.