<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextSearching-3wkjv/willHighlight(foundTextRange:document:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit15UITextSearchingP13willHighlight14foundTextRange8documentySo0bH0C_18DocumentIdentifierQzSgtF"
  },
  "title" : "willHighlight(foundTextRange:document:)"
}
-->

# willHighlight(foundTextRange:document:)

Informs the searchable object when the highlighted search result is about to change.

```
func willHighlight(foundTextRange: UITextRange, document: Self.DocumentIdentifier?)
```

## Parameters

`foundTextRange`

The text range to highlight.

`document`

A string that uniquely identifies the document containing the text range. `Nil` when searching a single document.

---

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)