<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextViewportLayoutControllerDelegate/viewportBounds(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextViewportLayoutControllerDelegate(im)viewportBoundsForTextViewportLayoutController:"
  },
  "title" : "viewportBounds(for:)"
}
-->

# viewportBounds(for:)

Returns the current viewport, which is the view visible bounds plus the overdraw area.

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

## Parameters

`textViewportLayoutController`

The [`NSTextViewportLayoutController`](/documentation/AppKit/NSTextViewportLayoutController).

## Return Value

A <doc://com.apple.documentation/documentation/CoreFoundation/CGRect>.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)