<!--
{
  "availability" : [
    "macOS: 10.12.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XcodeKit",
  "identifier" : "/documentation/XcodeKit/XCSourceEditorCommandInvocation",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "XcodeKit"
    ],
    "preciseIdentifier" : "c:objc(cs)XCSourceEditorCommandInvocation"
  },
  "title" : "XCSourceEditorCommandInvocation"
}
-->

# XCSourceEditorCommandInvocation

An object that identifies the command issued to your extension and provides the contents of the active source editor.

```
class XCSourceEditorCommandInvocation
```

## Topics

### Responding to Commands

[`var buffer: XCSourceTextBuffer`](/documentation/XcodeKit/XCSourceEditorCommandInvocation/buffer)

The buffer of source text upon which the command can operate.

[`var commandIdentifier: String`](/documentation/XcodeKit/XCSourceEditorCommandInvocation/commandIdentifier)

The identifier of the command that the user invoked.

### Responding to Cancelled Commands

[`var cancellationHandler: () -> Void`](/documentation/XcodeKit/XCSourceEditorCommandInvocation/cancellationHandler)

A handler to be invoked by Xcode to indicate that the invocation has been canceled by the user.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)