<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntents",
  "identifier" : "/documentation/AppIntents/AppEntity",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "App Intents"
    ],
    "preciseIdentifier" : "s:10AppIntents0A6EntityP"
  },
  "title" : "AppEntity"
}
-->

# AppEntity

An interface for making a custom type or app-specific concept discoverable by Apple Intelligence and experiences like Siri or the Shortcuts app.

```
protocol AppEntity : AppValue, DisplayRepresentable, Identifiable where Self == Self.ValueType, Self.ID : EntityIdentifierConvertible, Self.ID : Sendable
```

## Overview

To use a data model object to app intents, update it to conform to the
`AppEntity` protocol. Declare properties using the `@Property` property wrapper to make them visible
to the system. The following example from the [Accelerating app interactions with App Intents](/documentation/AppIntents/AcceleratingAppInteractionsWithAppIntents) sample app
shows a data model for a trail:

```swift
struct TrailEntity: AppEntity {
    // Provide the system with the interface required to query `TrailEntity` structures.
    static let defaultQuery = TrailEntityQuery()

    // The system requires the `AppEntity` identifier to be unique and persistant because the system may save it in a shortcut.
    var id: Trail.ID

    @Property var name: String

    @Property(title: "Region")
    var regionDescription: String

    @Property var trailLength: Measurement<UnitLength>

    var imageName: String

    var currentConditions: String

    /**
    Information on how to display the entity to people — for example, a string like the trail name. Include the optional subtitle
    and image for a visually rich display.
    */
    var displayRepresentation: DisplayRepresentation {
        DisplayRepresentation(title: "\(name)",
                              subtitle: "\(regionDescription)",
                              image: DisplayRepresentation.Image(named: imageName))
    }

    init(trail: Trail) {
        self.id = trail.id
        self.imageName = trail.featuredImage
        self.currentConditions = trail.currentConditions
        self.name = trail.name
        self.regionDescription = trail.regionDescription
        self.trailLength = trail.trailLength
    }
}

extension TrailEntity: URLRepresentableEntity {
    static var urlRepresentation: URLRepresentation {
        // Use string interpolation to fill values from your entity necessary for constructing the universal link URL.
        // This example URL uses the unique and persistant identifier for the `TrailEntity` in the URL.
        "https://example.com/trail/\(.id)/details"
    }
}
```

It is up to you whether you want to conform to the `AppEntity` protocol
directly on the data models of your app, or if you create data models specific
to your app intents implementation. In many cases, it’s a good idea to
create models specific to app intents that shadow your app data models to
keep entities separate from the rest of your app’s logic.

> Important: `AppEntity` instances have a total size limit of 10 MB, including all child properties and their values.
> If your entity exceeds this limit, the system throws an exception, and your app might crash.
> To reduce the size of your app entity, use the `@DeferredProperty`
> property wrapper. For more information,
> see <doc://com.apple.documentation/documentation/AppIntents/defining-app-entities-for-your-custom-data-types>.

## Topics

### Specifying properties

[`AppEntity.Property`](/documentation/AppIntents/AppEntity/Property)

### Making the entity queryable

[`defaultQuery`](/documentation/AppIntents/AppEntity/defaultQuery-4khg7)

The default query to use to retrieve entity property instances.

[`DefaultQuery`](/documentation/AppIntents/AppEntity/DefaultQuery-swift.associatedtype)

[`defaultResolverSpecification`](/documentation/AppIntents/AppEntity/defaultResolverSpecification-2dpf2)

[`defaultResolverSpecification`](/documentation/AppIntents/AppEntity/defaultResolverSpecification-589eq)

### URL representation

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

The type that provides the URL for an app entity.

### Ownership and sharing

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

A type that represents the ownership and sharing characteristics of an app entity.



---

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)