Contents

AnyAppEntity

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

Declaration

@dynamicMemberLookup struct AnyAppEntity

Mentioned in

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:

// 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

Instance Methods

Subscripts

See Also

Intermediate types