.messages.message reaction field type vs. error from macro

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? where Tapback is @AppEnum(schema: .messages.customReaction)
  • MessageReaction? (same, renamed)
  • MessageReaction? with manual AppEnum conformance (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:

  1. Update the schema-template comment in the docs to either name MessageReaction explicitly with a @UnionValue annotation, or include a one-line note: "The reaction field is a @UnionValue enum 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.

  2. Improve the diagnostic. Property type does not match required AppSchemaEntity property type 'ReadReactionCases:(Schema<Tapback> | AttributedString)' is unhelpful because ReadReactionCases doesn'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.

Thanks so much for this very interesting post.

This is an excellent well-documented issue. However I just check both links and I can’t find the #ReadReaction# placeholder. Is that on the documentation or on the sample code to download? Oh I see the Unicorn sample!! However I do not see it on that sample neither. :-(

The most effective next step is to file a bug report (Feedback Assistant) to get this routed to the App Intents and Documentation teams.

Filing this will ensure the App Intents or the documentation team sees the location and provides more information or a solution for that placeholder.

Once you open the bug report, please post the FB number here for my reference.

If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?

Albert  WWDR

.messages.message reaction field type vs. error from macro
 
 
Q