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

# NSTextViewportLayoutController

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

## Declaration

```swift
class NSTextViewportLayoutController
```

## Mentioned in

Managing viewport layout and attachment reuse in text views

## 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:)](uikit/nstextviewportlayoutcontroller/init(textlayoutmanager:).md)

### Accessing the layout manager

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

### Responding to changes in viewport layout

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

### Accessing the viewport characteristics

- [viewportBounds](uikit/nstextviewportlayoutcontroller/viewportbounds.md)
- [viewportRange](uikit/nstextviewportlayoutcontroller/viewportrange.md)
- [adjustViewport(byVerticalOffset:)](uikit/nstextviewportlayoutcontroller/adjustviewport(byverticaloffset:).md)
- [layoutViewport()](uikit/nstextviewportlayoutcontroller/layoutviewport().md)
- [relocateViewport(to:)](uikit/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)
- [Display text with a custom layout](uikit/display-text-with-a-custom-layout.md)
- [Managing viewport layout and attachment reuse in text views](uikit/managing-viewport-layout-and-attachment-reuse-in-a-text-view-subclass.md)
- [NSTextLayoutManager](uikit/nstextlayoutmanager.md)
- [NSTextContainer](uikit/nstextcontainer.md)
- [NSTextLayoutFragment](uikit/nstextlayoutfragment.md)
- [NSTextLineFragment](uikit/nstextlinefragment.md)
- [NSTextViewportRenderingSurface](uikit/nstextviewportrenderingsurface.md)
- [NSTextViewportRenderingSurfaceKey](uikit/nstextviewportrenderingsurfacekey.md)
- [NSTextLayoutOrientationProvider](uikit/nstextlayoutorientationprovider.md)
