---
title: "relocateViewport(to:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextviewportlayoutcontroller/relocateviewport(to:)"
---

# relocateViewport(to:)

Relocates the viewport to the location you specify.

## Declaration

```swift
func relocateViewport(to textLocation: any NSTextLocation) -> CGFloat
```

## Parameters

- `textLocation`: An NSTextLocation.

## See Also

### 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)
