---
title: NSCountCommand
framework: foundation
role: symbol
role_heading: Class
path: foundation/nscountcommand
---

# NSCountCommand

A command that counts the number of objects of a specified class in the specified object container.

## Declaration

```swift
class NSCountCommand
```

## Overview

Overview An instance of NSCountCommand counts the number of objects of a specified class in the specified object container (such as the number of words in a paragraph or document) and returns the result. NSCountCommand is part of Cocoa’s built-in scripting support. It works automatically to support the count command through key-value coding. Most applications don’t need to subclass NSCountCommand or call its methods.

## 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

### Related Documentation

- [Cocoa Scripting Guide](apple-archive/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_intro/SAppsIntro.html.md)

### Script Commands

- [NSScriptCommand](foundation/nsscriptcommand.md)
- [NSQuitCommand](foundation/nsquitcommand.md)
- [NSSetCommand](foundation/nssetcommand.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)
- [NSCloseCommand](foundation/nsclosecommand.md)
