UIFindSession
An abstract base class that manages the state, presentation, and behavior for a search that the find interaction initiates.
Declaration
@MainActor class UIFindSessionOverview
You return a session object from the delegate of a UIFindInteraction to manage the state, presentation, and behavior for a given search. The session object responds to navigation and replacement requests through its highlightNextResult(in:) and performSingleReplacement(query:replacementString:options:) methods. It also provides presentation information to the system find panel through resultCount and highlightedResultIndex.
UIKit can manage the state when you implement the UITextSearching protocol on a class that encapsulates the searchable content. To do this, create an instance of UITextSearchingFindSession and provide it a searchableObject using an instance of your class.
If you want to manage the state yourself or already have a class that implements find and replace for your app, you can subclass UIFindSession to bridge your custom implementation to the system UI.
Topics
Getting session information
resultCounthighlightedResultIndexsupportsReplacementallowsReplacementForCurrentlyHighlightedResultsearchResultDisplayStyleUIFindSession.SearchResultDisplayStyle
Managing session interactions
performSearch(query:options:)performSingleReplacement(query:replacementString:options:)replaceAll(searchQuery:replacementString:options:)highlightNextResult(in:)invalidateFoundResults()