Mac Developer Library

Developer

Foundation Framework Reference NSDeleteCommand Class Reference

Options
Deployment Target:

On This Page
Language:

NSDeleteCommand

Inheritance


Conforms To


Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in OS X v10.0 and later.

An instance of NSDeleteCommand deletes the specified scriptable object or objects (such as words, paragraphs, and so on).

Suppose, for example, a user executes a script that sends the command delete the third rectangle in the first document to the Sketch sample application (located in /Developer/Examples/AppKit). Cocoa creates an NSDeleteCommand object to perform the operation. When the command is executed, it uses the key-value coding mechanism (by invoking removeValueAtIndex:fromPropertyWithKey:) to remove the specified object or objects from their container. See the description for removeValueAtIndex:fromPropertyWithKey: for related information.

NSDeleteCommand is part of Cocoa’s built-in scripting support. Most applications don’t need to subclass NSDeleteCommand or call its methods.

  • Returns a specifier for the object or objects to be deleted.

    Declaration

    Swift

    var keySpecifier: NSScriptObjectSpecifier! { get }

    Objective-C

    @property(readonly, retain) NSScriptObjectSpecifier *keySpecifier

    Return Value

    A specifier for the object or objects to be deleted.

    Discussion

    Note that this may be different than the specifier or specifiers set by setReceiversSpecifier:.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Sets the receiver’s object specifier.

    Declaration

    Swift

    func setReceiversSpecifier(_ receiversRef: NSScriptObjectSpecifier)

    Objective-C

    - (void)setReceiversSpecifier:(NSScriptObjectSpecifier *)receiversRef

    Parameters

    receiversRef

    The receiver’s object specifier.

    Discussion

    This method overrides setReceiversSpecifier: in NSScriptCommand. It performs the same function as the overridden method, with a critical difference: it causes the container specifier part of the passed-in object specifier to become the receiver specifier of the command, and the key part of the passed-in object specifier to become the key specifier. If, for example, receiversRef is a specifier for the third rectangle of the first document, the receiver specifier is the first document while the key specifier is the third rectangle.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.0 and later.