---
title: NSTextViewportLayoutController
framework: appkit
role: symbol
role_heading: Class
path: appkit/nstextviewportlayoutcontroller
---

# NSTextViewportLayoutController

Manages the layout process inside the viewport interacting with its delegate.

## Declaration

```swift
class NSTextViewportLayoutController
```

## Overview

Overview A viewport is a rectangular area within a flipped coordinate system expanding along the y-axis. With text contents, lines advance expanding the view in the current writing direction. The viewport defines the active area where the framework lays out text fragments. In most cases, the area corresponds to the user visible area with an additional over-scroll region.

## Topics

### Creating a viewport layout controller

- [init(textLayoutManager:)](appkit/nstextviewportlayoutcontroller/init(textlayoutmanager:).md)

### Accessing the layout manager

- [textLayoutManager](appkit/nstextviewportlayoutcontroller/textlayoutmanager.md)

### Responding to changes in viewport layout

- [delegate](appkit/nstextviewportlayoutcontroller/delegate.md)
- [NSTextViewportLayoutControllerDelegate](appkit/nstextviewportlayoutcontrollerdelegate.md)

### Accessing the viewport characteristics

- [viewportBounds](appkit/nstextviewportlayoutcontroller/viewportbounds.md)
- [viewportRange](appkit/nstextviewportlayoutcontroller/viewportrange.md)
- [adjustViewport(byVerticalOffset:)](appkit/nstextviewportlayoutcontroller/adjustviewport(byverticaloffset:).md)
- [layoutViewport()](appkit/nstextviewportlayoutcontroller/layoutviewport().md)
- [relocateViewport(to:)](appkit/nstextviewportlayoutcontroller/relocateviewport(to:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Layout

- [Using TextKit 2 to interact with text](uikit/using-textkit-2-to-interact-with-text.md)
- [NSTextLayoutManager](appkit/nstextlayoutmanager.md)
- [NSTextContainer](appkit/nstextcontainer.md)
- [NSTextLayoutFragment](appkit/nstextlayoutfragment.md)
- [NSTextLineFragment](appkit/nstextlinefragment.md)
- [NSTextLayoutOrientationProvider](appkit/nstextlayoutorientationprovider.md)
