<!--
{
  "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/UITextSearchAggregator-c.protocol",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextSearchAggregator"
  },
  "title" : "UITextSearchAggregator"
}
-->

# UITextSearchAggregator

The methods you use on a find session’s aggregator to collect matching text ranges for a search.

```
@protocol UITextSearchAggregator <NSObject>
```

## Overview

To track text ranges that match the search, call these methods on the aggregator for the searchable object implementing the [`UITextSearching`](/documentation/UIKit/UITextSearching-53wjq) protocol for a [`UITextSearchingFindSession`](/documentation/UIKit/UITextSearchingFindSession).

## Topics

### Tracking search results

[`- (void) foundRange:(UITextRange *) range forSearchString:(NSString *) string inDocument:(UITextSearchDocumentIdentifier) document;`](/documentation/UIKit/UITextSearchAggregator-c.protocol/foundRange:forSearchString:inDocument:)

Adds a text range to the set of matches.

[`- (void) invalidateFoundRange:(UITextRange *) range inDocument:(UITextSearchDocumentIdentifier) document;`](/documentation/UIKit/UITextSearchAggregator-c.protocol/invalidateFoundRange:inDocument:)

Removes a text range from the set of matches.

[`- (void) invalidate;`](/documentation/UIKit/UITextSearchAggregator-c.protocol/invalidate)

Invalidates all currently shown ranges.

[`- (void) finishedSearching;`](/documentation/UIKit/UITextSearchAggregator-c.protocol/finishedSearching)

Finishes the search for text ranges.

[`@property (nonatomic, readonly) NSOrderedSet<UITextRange *> * allFoundRanges;`](/documentation/UIKit/UITextSearchAggregator-c.protocol/allFoundRanges)

An ordered set of all the text ranges that match the search.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)