---
title: "tag(for:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/containervalues/tag(for:)"
---

# tag(for:)

The tag value for the given type if the container values contains one.

## Declaration

```swift
func tag<V>(for type: V.Type) -> V? where V : Hashable
```

## Parameters

- `type`: The type to get the tag value for.

## Return Value

Return Value The tag value for the given type if the subview has one, otherwise nil.

## Discussion

Discussion Tag values are set using the View/tag modifier.
