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

# viewWithTag(_:)

Returns the view whose tag matches the specified value.

## Declaration

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

## Parameters

- `tag`: The tag value to search for.

## Return Value

Return Value The view in the receiver’s hierarchy whose tag property matches the value in the tag parameter.

## Discussion

Discussion This method searches the current view and all of its subviews for the specified view.

## See Also

### Identifying the view at runtime

- [tag](uikit/uiview/tag.md)
