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

# scrollRangeToVisible(_:inDocument:)

Scrolls to the containing view to make the text range visible.

```
func scrollRangeToVisible(_ range: UITextRange, inDocument: Self.DocumentIdentifier?)
```

## Parameters

`range`

The text range to scroll to.

`inDocument`

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

## Discussion

If the seachable object supports scrolling, use this method to implement scrolling your view to make the highlighted text range visible.

---

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)