---
title: "scrollRectToVisible(_:animated:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiscrollview/scrollrecttovisible(_:animated:)"
---

# scrollRectToVisible(_:animated:)

Scrolls a specific area of the content so that it’s visible in the scroll view.

## Declaration

```swift
func scrollRectToVisible(_ rect: CGRect, animated: Bool)
```

## Parameters

- `rect`: A rectangle defining an area of the content view. The rectangle should be in the coordinate space of the scroll view.
- `animated`: doc://com.apple.documentation/documentation/Swift/true if the scrolling should be animated, doc://com.apple.documentation/documentation/Swift/false if it should be immediate.

## Discussion

Discussion This method scrolls the content view so that the area defined by rect is just visible inside the scroll view. If the area is already visible, the method does nothing.
