<!--
{
  "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/AnyAppEnum",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "App Intents Testing"
    ],
    "preciseIdentifier" : "s:17AppIntentsTesting03AnyA4EnumV"
  },
  "title" : "AnyAppEnum"
}
-->

# AnyAppEnum

A type-erased representation of an app enumeration that provides dynamic enumeration value access.

```
struct AnyAppEnum
```

## Overview

Use `AnyAppEnum` to work with enumerations when you don’t know the specific enumeration type at compile time.
At compile, the [`AnyAppEnum`](/documentation/AppIntentsTesting/AnyAppEnum) structure resolves to your app enum type and gives you access to its value as shown in the following example:

```swift
let definitions = IntentDefinitions(
    bundleIdentifier: "com.apple.example"
)
let colorEnum = definitions.enums["Color"]
let priorityEnum = definitions.enums["Priority"]

// Creating enumeration cases.
let redCase = colorEnum.makeCase("red")
let highPriority = priorityEnum.makeCase("high")

// Accessing enumeration properties.
let rawValue = redCase.rawValue  // "red"

// Converting raw values in a type-safe way.
let colorName = try redCase.as(String.self)
let priorityLevel = try highPriority.as(String.self)
```

## Topics

### Creating an enum

[`init(typeIdentifier: String, rawValue: String)`](/documentation/AppIntentsTesting/AnyAppEnum/init(typeIdentifier:rawValue:))

Creates a new instance with the specified enumeration identifier and raw value.

[`init(typeIdentifier: String, value: any LosslessStringConvertible)`](/documentation/AppIntentsTesting/AnyAppEnum/init(typeIdentifier:value:))

Creates an enumeration with a typed raw value.

[`var typeIdentifier: String`](/documentation/AppIntentsTesting/AnyAppEnum/typeIdentifier)

The enumeration’s type identifier.

[`var rawValue: String`](/documentation/AppIntentsTesting/AnyAppEnum/rawValue)

The raw value of the selected enumeration option.

### Converting enum values

[`func `as`<T>(T.Type) throws -> T`](/documentation/AppIntentsTesting/AnyAppEnum/as(_:))

Casts the raw value to the specified type.

### Default Implementations

[CustomStringConvertible Implementations](/documentation/AppIntentsTesting/AnyAppEnum/CustomStringConvertible-Implementations)

## Relationships

### Conforms To

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

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

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

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

[`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)