<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntentsTesting",
  "identifier" : "/documentation/AppIntentsTesting/AnyAppEntity",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "App Intents Testing"
    ],
    "preciseIdentifier" : "s:17AppIntentsTesting03AnyA6EntityV"
  },
  "title" : "AnyAppEntity"
}
-->

# AnyAppEntity

A type-erased, intermediate representation of your app entity for testing purposes.

```
@dynamicMemberLookup struct AnyAppEntity
```

## Overview

The `AnyAppEntity` structure resolves to your actual entity type and gives you access
to its properties, enabling you to test your app entity code:

```swift
// Define your app entity type from your app bundle:
let definitions = IntentDefinitions(
    bundleIdentifier: "com.apple.example"
)
let exampleEntity = definitions.entities[
    "ExampleEntity"
]

// Create an entity from an identifier.
let entity = exampleEntity.makeReference(
    identifier: "my-example"
)

// Type-safe access to the entity's properties.
let name: String? = entity.name
let itemCount: Int? = entity.itemCount

// Accessing nested properties (requires try).
if try entity.profile.name == "John Doe" {
    print("User found")
}
```

## Topics

### Identifying the entity

[`var identifier: AttributedEntityIdentifier`](/documentation/AppIntentsTesting/AnyAppEntity/identifier)

The value that uniquely identifies the app entity.

### Instance Methods

[`func exported<T>(as: T.Type) async throws -> T`](/documentation/AppIntentsTesting/AnyAppEntity/exported(as:)-54w7m)

Exports this entity as a system intent value type.

[`func exported<T>(as: T.Type) async throws -> T`](/documentation/AppIntentsTesting/AnyAppEntity/exported(as:)-7pg2q)

Exports this entity as a transferable intent value type.

[`func exported(as: UTType?) async throws -> IntentFile`](/documentation/AppIntentsTesting/AnyAppEntity/exported(as:)-8qa8k)

Exports this entity’s content as an `IntentFile`.

### Subscripts

[`subscript(dynamicMember _: String) -> (any IntentValueExpressing)?`](/documentation/AppIntentsTesting/AnyAppEntity/subscript(dynamicMember:)-4bdp1)

Accesses an entity property by name, without casting.

[`subscript<T>(dynamicMember _: String) -> T`](/documentation/AppIntentsTesting/AnyAppEntity/subscript(dynamicMember:)-5twll)

Accesses an entity property by name, for comparison with a known value.

[`subscript(dynamicMember _: String) -> DynamicPropertyPath`](/documentation/AppIntentsTesting/AnyAppEntity/subscript(dynamicMember:)-yuv)

Accesses a nested entity property by name.

## Relationships

### Conforms To

[`Escapable`](/documentation/Swift/Escapable)

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`IntentValueConvertible`](/documentation/AppIntents/IntentValueConvertible)

[`Copyable`](/documentation/Swift/Copyable)

[`IntentValueExpressing`](/documentation/AppIntents/IntentValueExpressing)

[`Sendable`](/documentation/Swift/Sendable)

---

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)