---
title: UITextItem
framework: uikit
role: symbol
role_heading: Class
path: uikit/uitextitem
---

# UITextItem

An object for attaching custom actions and menus to links, text attachments, or other specific text in a text view.

## Declaration

```swift
@MainActor class UITextItem
```

## Overview

Overview A text item represents a link with a URL destination, a custom tag for a topic that you specify in your app, or a text attachment in a text view. In your text view’s UITextViewDelegate, implement textView(_:primaryActionFor:defaultAction:) to provide a custom action when someone interacts with a text item. Implement textView(_:menuConfigurationFor:defaultMenu:) to provide a custom menu for a text item.

## Topics

### Specifying the content type

- [content](uikit/uitextitem/content-swift.property.md)
- [UITextItem.Content](uikit/uitextitem/content-swift.enum.md)

### Specifying the range

- [range](uikit/uitextitem/range.md)

### Creating a menu

- [UITextItem.MenuConfiguration](uikit/uitextitem/menuconfiguration.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)
- [Sendable](swift/sendable.md)

## See Also

### Text actions and menus

- [UITextItem.MenuConfiguration](uikit/uitextitem/menuconfiguration.md)
- [UITextViewDelegate](uikit/uitextviewdelegate.md)
