---
title: "performTextSearch(queryString:options:resultAggregator:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextsearching-3wkjv/performtextsearch(querystring:options:resultaggregator:)"
---

# performTextSearch(queryString:options:resultAggregator:)

Searches for ranges of text matching the string across all searchable documents and collects results in the aggregator.

## Declaration

```swift
func performTextSearch(queryString: String, options: UITextSearchOptions, resultAggregator: UITextSearchAggregator<Self.DocumentIdentifier>)
```

## Parameters

- `queryString`: The string to search for.
- `options`: The configurable options to use for matching words and comparing strings.
- `resultAggregator`: An object you use to collect matching results. The aggregator is thread-safe, so you may send it messages on other threads.

## Discussion

Discussion The system calls this method during a find session to perform the search. Your implenentation should search for matching text ranges in your app’s documents and call foundRange(_:searchString:document:) on the aggregator object to add them to the set of matching ranges.

## See Also

### Handling searches

- [UITextSearchAggregator](uikit/uitextsearchaggregator-swift.struct.md)
- [compare(_:toRange:document:)](uikit/uitextsearching-3wkjv/compare(_:torange:document:).md)
- [compare(document:toDocument:)](uikit/uitextsearching-3wkjv/compare(document:todocument:).md)
- [DocumentIdentifier](uikit/uitextsearching-3wkjv/documentidentifier.md)
