---
title: "zoom(to:animated:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiscrollview/zoom(to:animated:)"
---

# zoom(to:animated:)

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

## Declaration

```swift
func zoom(to 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 view returned by doc://com.apple.uikit/documentation/UIKit/UIScrollViewDelegate/viewForZooming(in:).
- `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 zooms so that the content view becomes the area defined by rect, adjusting the zoomScale as necessary.

## See Also

### Zooming and panning

- [panGestureRecognizer](uikit/uiscrollview/pangesturerecognizer.md)
- [pinchGestureRecognizer](uikit/uiscrollview/pinchgesturerecognizer.md)
- [zoomScale](uikit/uiscrollview/zoomscale.md)
- [setZoomScale(_:animated:)](uikit/uiscrollview/setzoomscale(_:animated:).md)
- [maximumZoomScale](uikit/uiscrollview/maximumzoomscale.md)
- [minimumZoomScale](uikit/uiscrollview/minimumzoomscale.md)
- [isZoomBouncing](uikit/uiscrollview/iszoombouncing.md)
- [isZooming](uikit/uiscrollview/iszooming.md)
- [isZoomAnimating](uikit/uiscrollview/iszoomanimating.md)
- [bouncesZoom](uikit/uiscrollview/bounceszoom.md)
