I'm adding App Intents to my iOS16 app using the App Intents framework.
One of the intents I want to add opens a list view of all events in my app's database. The view in the app has a number of filters available, and I'm trying to replicate some of those filters in the intent.
I've got a couple of options already coded – one AppEnum
showing a time scope (past/future/all events), and one selector of publications (each event can have zero or one publication).
Following the techniques demonstrated in the WWDC2022 session Dive Into App Intents I've got that working:
struct OpenEventsList: AppIntent {
static var title: LocalizedStringResource = "Open Events List"
static var openAppWhenRun: Bool = true
@Parameter(title: "Scope")
var scope: TimeScope
@Parameter(title: "Publication")
var publication: PublicationEntity?
static var parameterSummary: some ParameterSummary {
Summary("Open \(\.$scope) for \(\.$publication)")
}
@MainActor
func perform() async throws -> some IntentResult {
// implementation omitted
}
}
This produces a working shortcut action:
In the WWDC talk, the speaker says:
You can also define which parameters show up below the fold and which are hidden. These APIs can do some pretty cool stuff, like varying the summary based on the actual values of any parameter of your intent, using the When and Otherwise APIs, or the Switch, Case, and Default APIs
...but I've not been able to find anywhere that explains these APIs. Apple's docs list some of the protocols involved, but that's it.
I'd like to be able to move the publications option below the fold, so the default parameter summary only includes the time-based option and, if the action box is expanded, the publication option (and other options as I may add later) are revealed.