Contents

UISearchTextField

A view for displaying and editing text and search tokens.

Declaration

@MainActor class UISearchTextField

Overview

Use a search text field to display search criteria represented as text and tokens, and allow the user to edit that criteria. Tokens are discrete representations of nontextual content that your app can create and use to represent filters that limit the search results. Tokens always occur contiguously before any text in the search field.

UISearchBar hosts a search text field, but you may also use a search text field in other roles, such as the title view of a UINavigationItem.

Tokens can be programmatically selected by including their position in a range assigned to the selectedTextRange property.

Topics

Converting text into tokens

Supporting token interactions

Adding and removing tokens

Customizing token behavior

Providing search suggestions

See Also

Search field