The documented template for @AppEntity(schema: .messages.message) at Integrating your messaging app with Apple Intelligence and on the MessagesEntity.message reference page shows:
var reaction: <#ReadReaction#>?
with <#ReadReaction#> rendered as a placeholder (the Xcode placeholder syntax). A natural reading is "fill in your own type that you want to use here". I tried several:
Tapback?whereTapbackis@AppEnum(schema: .messages.customReaction)MessageReaction?(same, renamed)MessageReaction?with manualAppEnumconformance (no schema decoration)AttributedString?AttributedString(non-optional)- field omitted entirely
Each variant produced one of:
error: Property 'reaction' type does not match required AppSchemaEntity property type 'ReadReactionCases:(Schema<Tapback> | AttributedString)'
error: Required AppSchemaEntity property 'reaction' must be optional
error: Missing required property 'reaction' from AppSchemaEntity 'messages.message'
The phrase ReadReactionCases:(Schema<Tapback> | AttributedString) is opaque — ReadReactionCases isn't a public type, Schema<Tapback> isn't constructable from outside, and the documentation doesn't mention @UnionValue in this context.
The actual working pattern, which I only found by downloading the UnicornChat sample and reading MessageEntity.swift, is:
@UnionValue
enum MessageReaction: Sendable {
case customReaction(CustomReaction)
}
@AppEnum(schema: .messages.customReaction)
enum CustomReaction: String, AppEnum {
case sticker
static let caseDisplayRepresentations: [Self: DisplayRepresentation] = [
.sticker: "Sticker"
]
}
Two suggestions:
-
Update the schema-template comment in the docs to either name
MessageReactionexplicitly with a@UnionValueannotation, or include a one-line note: "The reaction field is a@UnionValueenum wrapping the customReaction schema enum — see UnicornChat sample." The current placeholder<#ReadReaction#>plus the prose suggesting "you can generate the properties... with the@AppEntity(.messages.message)Swift macro" reads as if the developer just supplies any AppEnum-conformer. -
Improve the diagnostic.
Property type does not match required AppSchemaEntity property type 'ReadReactionCases:(Schema<Tapback> | AttributedString)'is unhelpful becauseReadReactionCasesdoesn't appear in any reachable type. Either rename to something developer-facing, or include a fix-it that suggests@UnionValue.
iOS 27.0 beta, Xcode 27 beta, macOS Tahoe 26.4.