<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextSearching-53wjq/performTextSearchWithQueryString:usingOptions:resultAggregator:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextSearching(im)performTextSearchWithQueryString:usingOptions:resultAggregator:"
  },
  "title" : "performTextSearchWithQueryString:usingOptions:resultAggregator:"
}
-->

# performTextSearchWithQueryString:usingOptions:resultAggregator:

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

```
- (void) performTextSearchWithQueryString:(NSString *) string usingOptions:(UITextSearchOptions *) options resultAggregator:(id<UITextSearchAggregator>) aggregator;
```

## Parameters

`string`

The string to search for.

`options`

The configurable options to use for matching words and comparing strings.

`aggregator`

An object you use to collect matching results. The aggregator is thread-safe, so you may send it messages on other threads.

## 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:)`](/documentation/UIKit/UITextSearchAggregator-swift.struct/foundRange(_:searchString:document:)) on the aggregator object to add them to the set of matching ranges.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)