---
title: "viewportBounds(for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextview/viewportbounds(for:)"
---

# viewportBounds(for:)

NSTextViewportLayoutControllerDelegate method that the framework calls to request the current viewport, which is the view visible bounds plus the overdraw area. Requires a call to super.

## Declaration

```swift
func viewportBounds(for textViewportLayoutController: NSTextViewportLayoutController) -> CGRect
```

## Mentioned in

Managing viewport layout and attachment reuse in text views

## See Also

### Customizing viewport layout

- [textViewportLayoutControllerWillLayout(_:)](uikit/uitextview/textviewportlayoutcontrollerwilllayout(_:).md)
- [textViewportLayoutControllerDidLayout(_:)](uikit/uitextview/textviewportlayoutcontrollerdidlayout(_:).md)
- [textViewportLayoutControllerReceivedSetNeedsLayout(_:)](uikit/uitextview/textviewportlayoutcontrollerreceivedsetneedslayout(_:).md)
