AppUnionValue
A protocol that provides nominal type identity and metadata for union values.
Declaration
protocol AppUnionValue : TypeDisplayRepresentableOverview
Union values conforming to this protocol can be used as Shortcuts parameters with rich metadata support, enabling appropriate picker UI and parameter summaries.
The @UnionValue macro automatically generates conformance to this protocol. You can provide custom metadata by implementing the protocol requirements in an extension.
Example:
@UnionValue
enum Reaction {
case tapback(Tapback)
case text(String)
}
extension Reaction {
static var typeDisplayRepresentation: TypeDisplayRepresentation {
"Reaction"
}
static let caseDisplayRepresentations: [Cases: DisplayRepresentation] = [
.tapback: "Tapback",
.text: "Text Reaction"
]
}