---
title: "scrollRectToVisible(_:)"
framework: quartzcore
role: symbol
role_heading: Instance Method
path: "quartzcore/calayer/scrollrecttovisible(_:)"
---

# scrollRectToVisible(_:)

Initiates a scroll in the layer’s closest ancestor scroll layer so that the specified rectangle becomes visible.

## Declaration

```swift
func scrollRectToVisible(_ r: CGRect)
```

## Parameters

- `r`: The rectangle to be made visible.

## Discussion

Discussion If the layer is not contained by a CAScrollLayer object, this method does nothing.

## See Also

### Scrolling

- [visibleRect](quartzcore/calayer/visiblerect.md)
- [scroll(_:)](quartzcore/calayer/scroll(_:).md)
