Assistant schema conformance for app entities that describe text documents.
Members (3)
get · iOS 16.0+
page
Swift declaration
var page: some AssistantSchemas.Entity { get }
The app entity describes a page in a text document.
## 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 `.wordProcessor.page` schema:
```swift
@AppEntity(schema: .wordProcessor.page)
struct WordProcessorPageEntity: AppEntity {
struct Query: EntityStringQuery {
func entities(for identifiers: [WordProcessorPageEntity.ID]) async throws -> [WordProcessorPageEntity] { [] }
func entities(matching string: String) async throws -> [WordProcessorPageEntity] { [] }
}
static var defaultQuery = Query()
var displayRepresentation: DisplayRepresentation { "Text Document Page" }
let id = UUID()
@Property
var document: WordProcessorDocumentEntity
@Property
var pageIndex: Int
}
```
get · iOS 16.0+
document
Swift declaration
var document: some AssistantSchemas.Entity { get }
The app entity describes a text document.
## 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 `.wordProcessor.document` schema:
```swift
@AppEntity(schema: .wordProcessor.document)
struct WordProcessorDocumentEntity: AppEntity {
struct Query: EntityStringQuery {
func entities(for identifiers: [WordProcessorDocumentEntity.ID]) async throws -> [WordProcessorDocumentEntity] { [] }
func entities(matching string: String) async throws -> [WordProcessorDocumentEntity] { [] }
}
static var defaultQuery = Query()
var displayRepresentation: DisplayRepresentation { "Text Document" }
let id = UUID()
@Property
var name: String
@Property
var creationDate: Date?
@Property
var modificationDate: Date?
}
```
get · iOS 16.0+
template
Swift declaration
var template: some AssistantSchemas.Entity { get }
The app entity describes a text document template.
## 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 `.wordProcessor.template` schema:
```swift
@AppEntity(schema: .wordProcessor.template)
struct WordProcessorDocumentTemplateEntity: AppEntity {
struct Query: EntityStringQuery {
func entities(for identifiers: [WordProcessorDocumentTemplateEntity.ID]) async throws -> [WordProcessorDocumentTemplateEntity] { [] }
func entities(matching string: String) async throws -> [WordProcessorDocumentTemplateEntity] { [] }
}
static var defaultQuery = Query()
var displayRepresentation: DisplayRepresentation { "Text Document Template" }
let id = UUID()
@Property
var name: String
}
```