---
title: NSDeleteCommand
framework: foundation
role: symbol
role_heading: Class
path: foundation/nsdeletecommand
---

# NSDeleteCommand

A command that deletes a scriptable object.

## Declaration

```swift
class NSDeleteCommand
```

## Overview

Overview 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 removeValue(at: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.

## Topics

### Working with specifiers

- [keySpecifier](foundation/nsdeletecommand/keyspecifier.md)
- [setReceiversSpecifier(_:)](foundation/nsdeletecommand/setreceiversspecifier(_:).md)

## Relationships

### Inherits From

- [NSScriptCommand](foundation/nsscriptcommand.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Script Commands

- [NSScriptCommand](foundation/nsscriptcommand.md)
- [NSQuitCommand](foundation/nsquitcommand.md)
- [NSSetCommand](foundation/nssetcommand.md)
- [NSMoveCommand](foundation/nsmovecommand.md)
- [NSCreateCommand](foundation/nscreatecommand.md)
- [NSExistsCommand](foundation/nsexistscommand.md)
- [NSGetCommand](foundation/nsgetcommand.md)
- [NSCloneCommand](foundation/nsclonecommand.md)
- [NSCountCommand](foundation/nscountcommand.md)
- [NSCloseCommand](foundation/nsclosecommand.md)
