<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextSelectionRect",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITextSelectionRect"
  },
  "title" : "UITextSelectionRect"
}
-->

# UITextSelectionRect

An encapsulation of information about a selected range of text in a document.

```
@MainActor class UITextSelectionRect
```

## Overview

This class is an abstract class and must be subclassed to be used. The system text input views provide their own concrete implementations of this class.

### Subclassing Notes

If you are implementing a custom text input view, you can subclass and use your custom class to return selection-related information. When subclassing, you should override and reimplement all properties. In your custom implementations, do not call `super`.

## Topics

### Accessing the Selection Rectangle

[`rect`](/documentation/UIKit/UITextSelectionRect/rect)

The rectangle that encloses the text selection rectangle’s text range.

### Accessing Text-Related Attributes

[`writingDirection`](/documentation/UIKit/UITextSelectionRect/writingDirection)

The writing direction of text in the text selection rectangle’s text range.

[`isVertical`](/documentation/UIKit/UITextSelectionRect/isVertical)

A Boolean value that indicates whether the text is vertical.

### Determining the Selection Status

[`containsStart`](/documentation/UIKit/UITextSelectionRect/containsStart)

A Boolean value that indicates whether the rectangle contains the start of the selection.

[`containsEnd`](/documentation/UIKit/UITextSelectionRect/containsEnd)

A Boolean value that indicates whether the rectangle contains the end of the selection.

## Relationships

### Inherits From

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

### Conforms To

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

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

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

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

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

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

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

---

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)