---
title: "anchorWithOffset(to:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nslayoutxaxisanchor/anchorwithoffset(to:)"
---

# anchorWithOffset(to:)

Creates a layout dimension object from two anchors.

## Declaration

```swift
func anchorWithOffset(to otherAnchor: NSLayoutXAxisAnchor) -> NSLayoutDimension
```

## Parameters

- `otherAnchor`: The second anchor to use when creating the layout dimension.

## Return Value

Return Value The NSLayoutDimension object represented by the two anchors.

## Discussion

Discussion Use the returned object to define constraints relative to the space between the current anchor and the object in the otherAnchor parameter.
