---
title: "constrainBoundsRect(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsclipview/constrainboundsrect(_:)"
---

# constrainBoundsRect(_:)

Constrains the bounds of the clip view while the user is magnifying and scrolling.

## Declaration

```swift
func constrainBoundsRect(_ proposedBounds: NSRect) -> NSRect
```

## Parameters

- `proposedBounds`: The bounds to use to ensure that the view will still lie within its document view.

## Return Value

Return Value A bounds rectangle.

## Discussion

Discussion Note that you can move an implementation of the deprecated constrainScroll(_:) to this method by adjusting the origin of proposedBounds (instead of using the newOrigin parameter in -constrainScrollPoint:). To preserve compatibility, if a subclass overrides -constrainScrollPoint:, the default behavior of constrainBoundsRect(_:) will be to use that -constrainScrollPoint: to adjust the origin of proposedBounds, and to not change the size.

## See Also

### Scrolling

- [scroll(to:)](appkit/nsclipview/scroll(to:).md)
- [autoscroll(with:)](appkit/nsclipview/autoscroll(with:).md)
- [constrainScroll(_:)](appkit/nsclipview/constrainscroll(_:).md)
