Contents

item

The app entity describes an item on a whiteboard canvas.

Declaration

var item: some AssistantSchemas.Entity { get }

Overview

Use Swift macros that generate additional properties and add protocol conformance for your app entity implementation. The following example shows an app entity that conforms to the .whiteboard.item schema:

@AppEntity(schema: .whiteboard.item)
struct CanvasItemEntity: AppEntity {
    struct Query: EntityStringQuery {
        func entities(for identifiers: [CanvasItemEntity.ID]) async throws -> [CanvasItemEntity] { [] }
        func entities(matching string: String) async throws -> [CanvasItemEntity] { [] }
    }

    static var defaultQuery = Query()
    var displayRepresentation: DisplayRepresentation { "Canvas Item" }

    let id = UUID()

    @Property
    var type: CanvasItemType

    @Property
    var label: String?

    @Property
    var x: Double

    @Property
    var y: Double

    @Property
    var width: Double?

    @Property
    var height: Double?
}

For more information about the .whiteboard app intent domain, see Making whiteboard actions available to Siri and Apple Intelligence. For general information about app intent domains, see Integrating actions with Siri and Apple Intelligence.

See Also

Content and parameter types