---
title: "offset(x:y:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/offset(x:y:)"
---

# offset(x:y:)

Offset this view by the specified horizontal and vertical distances.

## Declaration

```swift
nonisolated func offset(x: CGFloat = 0, y: CGFloat = 0) -> some View

```

## Parameters

- `x`: The horizontal distance to offset this view.
- `y`: The vertical distance to offset this view.

## Mentioned in

Making fine adjustments to a view’s position

## Return Value

Return Value A view that offsets this view by x and y.

## Discussion

Discussion Use offset(x:y:) to shift the displayed contents by the amount specified in the x and y parameters. The original dimensions of the view aren’t changed by offsetting the contents; in the example below the gray border drawn by this view surrounds the original position of the text: Text("Offset by passing horizontal & vertical distance")     .border(Color.green)     .offset(x: 20, y: 50)     .border(Color.gray)

## See Also

### Adjusting a view’s position

- [Making fine adjustments to a view’s position](swiftui/making-fine-adjustments-to-a-view-s-position.md)
- [position(_:)](swiftui/view/position(_:).md)
- [position(x:y:)](swiftui/view/position(x:y:).md)
- [offset(_:)](swiftui/view/offset(_:).md)
- [offset(z:)](swiftui/view/offset(z:).md)
