---
title: "relocateViewport(to:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/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](uikit/nstextviewportlayoutcontroller/viewportbounds.md)
- [viewportRange](uikit/nstextviewportlayoutcontroller/viewportrange.md)
- [adjustViewport(byVerticalOffset:)](uikit/nstextviewportlayoutcontroller/adjustviewport(byverticaloffset:).md)
- [layoutViewport()](uikit/nstextviewportlayoutcontroller/layoutviewport().md)
