<!--
{
  "availability" : [
    "macOS: 10.12.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSLayoutYAxisAnchor/anchorWithOffset(to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLayoutYAxisAnchor(im)anchorWithOffsetToAnchor:"
  },
  "title" : "anchorWithOffset(to:)"
}
-->

# anchorWithOffset(to:)

Creates a layout dimension object from two anchors.

```
func anchorWithOffset(to otherAnchor: NSLayoutYAxisAnchor) -> NSLayoutDimension
```

## Parameters

`otherAnchor`

The second anchor to use when creating the layout dimension.

## Return Value

The [`NSLayoutDimension`](/documentation/AppKit/NSLayoutDimension) object represented by the two anchors.

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)