Contents

OwnershipProvidingEntity

A type that provides the system with ownership and sharing context for an app entity.

Declaration

protocol OwnershipProvidingEntity : AppEntity

Overview

When your app passes app entities as parameters to an AppIntent and returns them from app intent results, people can use Apple Intelligence, Siri, and custom shortcuts to work with those entities across apps. For destructive or sensitive actions like deleting or updating an app entity, your app can require a person’s confirmation. Additionally, Apple Intelligence and Siri may also request a person’s confirmation. Conform your app entities to OwnershipProvidingEntity so the system prompts for confirmation — with appropriate context in the confirmation dialog — when an intent acts on shared or publicly accessible app entities.

The following example shows an app entity for a photo album that updates its ownership based on whether a person shares the album with their family or publishes it publicly:

@AppEntity(schema: .photos.album)
struct PhotoAlbumEntity: OwnershipProvidingEntity {
    let id = UUID()
    var isSharedWithFamily: Bool
    var isPublicAlbum: Bool

    // MARK: - .photos.album properties
    var name: String
    var creationDate: Date?
    var albumType: PhotoAlbumType

    var ownership: EntityOwnership {
        var ownership: EntityOwnership = []
        if isSharedWithFamily {
            ownership.insert(.shared)
        }
        if isPublicAlbum {
            ownership.insert(.public)
        }
        return ownership
    }
}

Topics

Instance Properties

See Also

App entity types