---
title: topAnchor
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsview/topanchor
---

# topAnchor

A layout anchor representing the top edge of the view’s frame.

## Declaration

```swift
var topAnchor: NSLayoutYAxisAnchor { get }
```

## Discussion

Discussion Use this anchor to create constraints with the view’s top edge. You can only combine this anchor with other NSLayoutYAxisAnchor anchors. For more information, see NSLayoutAnchor.

## See Also

### Creating Constraints Using Layout Anchors

- [bottomAnchor](appkit/nsview/bottomanchor.md)
- [centerXAnchor](appkit/nsview/centerxanchor.md)
- [centerYAnchor](appkit/nsview/centeryanchor.md)
- [firstBaselineAnchor](appkit/nsview/firstbaselineanchor.md)
- [heightAnchor](appkit/nsview/heightanchor.md)
- [lastBaselineAnchor](appkit/nsview/lastbaselineanchor.md)
- [leadingAnchor](appkit/nsview/leadinganchor.md)
- [leftAnchor](appkit/nsview/leftanchor.md)
- [rightAnchor](appkit/nsview/rightanchor.md)
- [trailingAnchor](appkit/nsview/trailinganchor.md)
- [widthAnchor](appkit/nsview/widthanchor.md)
