---
title: NSSetCommand
framework: foundation
role: symbol
role_heading: Class
path: foundation/nssetcommand
---

# NSSetCommand

A command that sets one or more attributes or relationships to one or more values.

## Declaration

```swift
class NSSetCommand
```

## Overview

Overview An instance of NSSetCommand sets one or more attributes or relationships to one or more values; for example, it may set the (x, y) coordinates for a window’s position or set the name of a document. NSSetCommand is part of Cocoa’s built-in scripting support. It works automatically to support the set command through key-value coding. Most applications don’t need to subclass NSSetCommand or call its methods. NSSetCommand uses available scripting class descriptions to determine whether it should set a value for an attribute (or property), or set a value for all elements (to-many objects). For the latter, it invokes replaceValue(at:inPropertyWithKey:withValue:); for the former, it invokes setValue(_:forKey:) (or, if the receiver overrides takeValue(_:forKey:), it invokes that method, to support backward binary compatibility.) For information on working with set commands, see Getting and Setting Properties and Elements in Cocoa Scripting Guide.

## Topics

### Working with specifiers

- [keySpecifier](foundation/nssetcommand/keyspecifier.md)
- [setReceiversSpecifier(_:)](foundation/nssetcommand/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)
- [NSMoveCommand](foundation/nsmovecommand.md)
- [NSCreateCommand](foundation/nscreatecommand.md)
- [NSDeleteCommand](foundation/nsdeletecommand.md)
- [NSExistsCommand](foundation/nsexistscommand.md)
- [NSGetCommand](foundation/nsgetcommand.md)
- [NSCloneCommand](foundation/nsclonecommand.md)
- [NSCountCommand](foundation/nscountcommand.md)
- [NSCloseCommand](foundation/nsclosecommand.md)
