Consider the following in an AppIntent:
struct TestIntent: AppIntent {
static let title: LocalizedStringResource = "Test Intent"
static var parameterSummary: some ParameterSummary {
Summary("Test") {
\.$options
}
}
enum Option: Int, CaseIterable, AppEnum {
case one
case two
case three
case four
case five
case six
static let typeDisplayRepresentation: TypeDisplayRepresentation =
TypeDisplayRepresentation(
name: "Options"
)
static let caseDisplayRepresentations: [Option: DisplayRepresentation] = [
.one: DisplayRepresentation(title: "One"),
.two: DisplayRepresentation(title: "Two"),
.three: DisplayRepresentation(title: "Three"),
.four: DisplayRepresentation(title: "Four"),
.five: DisplayRepresentation(title: "Five"),
.six: DisplayRepresentation(title: "Six"),
]
}
@Parameter(title: "Options", default: [])
var options: [Option]
@MainActor
func perform() async throws -> some IntentResult {
print(options)
return .result()
}
}
In Shortcuts, this will turn into a dropdown where you can check multiple Option values. However, when perform() is called, options
will be an empty array regardless of what the user selects. This is observed on both iOS 18.5 and macOS 15.5. However, on iOS 26.0 beta and macOS 26.0 beta, the issue seems to be resolved and options
contains all the checked options. However, we do back deploy to current/previous iOS/macOS versions. How can we provide a multiple choice selection of fixed values on these older versions?