Contents

affinityState

An enum schema for an affinity state parameter.

Declaration

var affinityState: some AppSchemaEnum { get }

Discussion

To make your app’s parameter types available to Apple Intelligence, conform your AppEnum to a schema that describes a parameter’s possible values to the system. If your app’s functionality aligns with the audio domain and a parameter type matches the affinityState schema, you can generate the protocol conformance the schema requires for your app enum implementation with the @AppEnum( .audio.affinityState) Swift macro. To make your app work with Siri, see Apple Intelligence and Siri AI.

The following example shows an app enum that conforms to the affinityState schema:

@AppEnum(schema: .audio.affinityState)
enum AffinityState: String {
    case like
    case dislike
    case unset

    static let caseDisplayRepresentations: [Self: DisplayRepresentation] = [
        .like: "Like",
        .dislike: "Dislike",
        .unset: "Unset"
    ]
}

The schema supports the following system experiences:

  • Siri

  • Shortcuts

For more information about the App Intents framework and the experiences it supports, see Getting started with the App Intents framework.

See Also

Types for static parameters