---
title: UISearchToken
framework: uikit
role: symbol
role_heading: Class
path: uikit/uisearchtoken
---

# UISearchToken

Search criteria in a search text field, represented by text and an optional icon.

## Declaration

```swift
@MainActor class UISearchToken
```

## Overview

Overview Use search tokens to help users understand and edit complex search queries in a UISearchTextField. A token acts like a single character in standard text interactions such as deleting, selecting, or dragging. A search token should always have text and may also have an icon.

Assign a representedObject to each search token that’s meaningful to your app. By attaching this extra data to the token you can reconstruct the full search query using information available in the search field when, for example, your app starts from state restoration or the user starts a search. See Using suggested searches with a search controller to learn how to use search tokens.

## Topics

### Creating a search token

- [init(icon:text:)](uikit/uisearchtoken/init(icon:text:).md)
- [representedObject](uikit/uisearchtoken/representedobject.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

### Search field

- [UISearchTextField](uikit/uisearchtextfield.md)
- [UISearchTextFieldDelegate](uikit/uisearchtextfielddelegate.md)
