---
title: "viewWithTag(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsview/viewwithtag(_:)"
---

# viewWithTag(_:)

Returns the view’s nearest descendant (including itself) with a specific tag, or nil if no subview has that tag.

## Declaration

```swift
func viewWithTag(_ tag: Int) -> NSView?
```

## Parameters

- `tag`: An integer identifier associated with a view object.

## See Also

### Identifying Views by Tag

- [tag](appkit/nsview/tag.md)
