---
title: UIFindSession
framework: uikit
role: symbol
role_heading: Class
path: uikit/uifindsession
---

# UIFindSession

An abstract base class that manages the state, presentation, and behavior for a search that the find interaction initiates.

## Declaration

```swift
@MainActor class UIFindSession
```

## Overview

Overview 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

- [resultCount](uikit/uifindsession/resultcount.md)
- [highlightedResultIndex](uikit/uifindsession/highlightedresultindex.md)
- [supportsReplacement](uikit/uifindsession/supportsreplacement.md)
- [allowsReplacementForCurrentlyHighlightedResult](uikit/uifindsession/allowsreplacementforcurrentlyhighlightedresult.md)
- [searchResultDisplayStyle](uikit/uifindsession/searchresultdisplaystyle-swift.property.md)
- [UIFindSession.SearchResultDisplayStyle](uikit/uifindsession/searchresultdisplaystyle-swift.enum.md)

### Managing session interactions

- [performSearch(query:options:)](uikit/uifindsession/performsearch(query:options:).md)
- [performSingleReplacement(query:replacementString:options:)](uikit/uifindsession/performsinglereplacement(query:replacementstring:options:).md)
- [replaceAll(searchQuery:replacementString:options:)](uikit/uifindsession/replaceall(searchquery:replacementstring:options:).md)
- [highlightNextResult(in:)](uikit/uifindsession/highlightnextresult(in:).md)
- [invalidateFoundResults()](uikit/uifindsession/invalidatefoundresults().md)

### Deprecated

- [allowsReplacement](uikit/uifindsession/allowsreplacement.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [UITextSearchingFindSession](uikit/uitextsearchingfindsession.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

### Find and replace

- [UIFindInteraction](uikit/uifindinteraction.md)
- [UIFindInteractionDelegate](uikit/uifindinteractiondelegate.md)
- [UITextSearchingFindSession](uikit/uitextsearchingfindsession.md)
- [UITextSearching](uikit/uitextsearching-3wkjv.md)
- [UITextSearchOptions](uikit/uitextsearchoptions.md)
- [UITextSearchFoundTextStyle](uikit/uitextsearchfoundtextstyle.md)
- [UITextSearchOptions.WordMatchMethod](uikit/uitextsearchoptions/wordmatchmethod-swift.enum.md)
- [UIFindSession.SearchResultDisplayStyle](uikit/uifindsession/searchresultdisplaystyle-swift.enum.md)
