<!--
{
  "availability" : [
    "macOS: 10.12 -"
  ],
  "documentType" : "symbol",
  "framework" : "XcodeKit",
  "identifier" : "/documentation/XcodeKit",
  "metadataVersion" : "0.1.0",
  "role" : "Framework",
  "symbol" : {
    "kind" : "Framework",
    "modules" : [
      "XcodeKit"
    ],
    "preciseIdentifier" : "XcodeKit"
  },
  "title" : "XcodeKit"
}
-->

# XcodeKit

Create extensions to add commands to the Xcode source editor.

## Overview

Using the XcodeKit framework, you can customize Xcode with source editor extensions to add functionality and specialized behavior to the source editor. Source editor extensions provide a group of editor commands alongside the built-in commands in the Editor menu in Xcode.  Source editor extensions can read and modify the contents of a source file, as well as read and modify the current text selection within the editor. Include source editor extensions in developer apps distributed on the Mac App Store.

## Topics

### Essentials

Add a source editor extension target to an Xcode project and activate its scheme.

[Creating a Source Editor Extension](/documentation/XcodeKit/creating-a-source-editor-extension)

Add and configure a source editor extension in your Xcode project.

[Testing Your Source Editor Extension](/documentation/XcodeKit/testing-your-source-editor-extension)

Launch a special instance of Xcode to test your source editor extension.

[`XCSourceEditorExtension`](/documentation/XcodeKit/XCSourceEditorExtension)

The protocol you implement to create Xcode source editor extensions.

### Editor Commands

Respond to commands by changing the text contents and text selections in a source editor.

[`XCSourceEditorCommand`](/documentation/XcodeKit/XCSourceEditorCommand)

The protocol you implement to handle command invocations in a source editor extension.

[`XCSourceEditorCommandInvocation`](/documentation/XcodeKit/XCSourceEditorCommandInvocation)

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

### Source Text

[`XCSourceTextBuffer`](/documentation/XcodeKit/XCSourceTextBuffer)

A buffer you use to access and modify the text contents and text selections in a source editor.

[`XCSourceTextPosition`](/documentation/XcodeKit/XCSourceTextPosition)

A zero-based position in a source editor, defined by a line number and column number.

[`XCSourceTextRange`](/documentation/XcodeKit/XCSourceTextRange)

A half-open range of text in a buffer you use to select text or specify the insertion point for new text.

### XcodeKit Constants

[XcodeKit Version Constants](/documentation/XcodeKit/xcodekit-version-constants)

Determine the version of XcodeKit available in an instance of Xcode.



---

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)
