<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ContainerValues/hasTag(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI15ContainerValuesV6hasTagySbxSHRzlF"
  },
  "title" : "hasTag(_:)"
}
-->

# hasTag(_:)

Returns true if the container values contain a tag matching a given
value.

```
func hasTag<V>(_ tag: V) -> Bool where V : Hashable
```

## Parameters

`tag`

The tag value to check for.

## Return Value

If the container values has a tag matching the given value.

## Discussion

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

---

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)