---
title: "entity(for:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/realityviewattachments/entity(for:)"
---

# entity(for:)

Gets the identified attachment view as an entity, if the view with that identifier exists.

## Declaration

```swift
func entity(for id: some Hashable) -> ViewAttachmentEntity?
```

## Parameters

- `id`: The value that you used to tag the view when you define it in the attachments parameter of the doc://com.apple.RealityKit/documentation/RealityKit/RealityView initializer doc://com.apple.RealityKit/documentation/RealityKit/RealityView/init(make:update:attachments:).

## Return Value

Return Value The resolved attachment entity, or nil if RealityView can’t find an attachment view with the given id.

## Discussion

Discussion Attachment entities are not automatically added to your RealityView’s content. To display an attachment, add it to your RealityView’s content using a function like RealityViewContent/add(_:).
