---
title: XCSourceTextBuffer
framework: XcodeKit
role: symbol
role_heading: Class
platforms: [macOS 10.12+]
path: xcodekit/xcsourcetextbuffer
---

# XCSourceTextBuffer

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

## Declaration

```swift
class XCSourceTextBuffer
```

## Overview

Overview Mutations to the buffer are tracked and committed when a command completes successfully and has not been canceled by the user.

## Topics

### Accessing Source Text

- [completeBuffer](xcodekit/xcsourcetextbuffer/completebuffer.md)
- [contentUTI](xcodekit/xcsourcetextbuffer/contentuti.md)

### Editing Source Text

- [lines](xcodekit/xcsourcetextbuffer/lines.md)
- [selections](xcodekit/xcsourcetextbuffer/selections.md)

### Configuring Source Editor Indentation

- [indentationWidth](xcodekit/xcsourcetextbuffer/indentationwidth.md)
- [usesTabsForIndentation](xcodekit/xcsourcetextbuffer/usestabsforindentation.md)
- [tabWidth](xcodekit/xcsourcetextbuffer/tabwidth.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Source Text

- [XCSourceTextPosition](xcodekit/xcsourcetextposition.md)
- [XCSourceTextRange](xcodekit/xcsourcetextrange.md)
