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

# XCSourceTextRange

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

## Declaration

```swift
class XCSourceTextRange
```

## Overview

Overview Source text ranges are half-open ranges. As a result, source text ranges include the character at the start position but exclude the character at the end position. A range with equal start and end positions may be used to indicate a point within the buffer, such as an insertion point. The start and end position may be improperly ordered while you prepare them in your own code, but must be properly ordered before passing an XCSourceTextRange instance to other methods.

## Topics

### Creating Source Text Ranges

- [init(start:end:)](xcodekit/xcsourcetextrange/init(start:end:).md)

### Getting the Bounds of Source Text Ranges

- [start](xcodekit/xcsourcetextrange/start.md)
- [end](xcodekit/xcsourcetextrange/end.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)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Source Text

- [XCSourceTextBuffer](xcodekit/xcsourcetextbuffer.md)
- [XCSourceTextPosition](xcodekit/xcsourcetextposition.md)
