I’ve seen that some of Apple’s apps group the automatically generated "Find XYZ" actions into custom categories. For example Safari, Calendar, or Reminders do this.
I know that you can group AppIntents
into custom categories via:
static let description: IntentDescription = IntentDescription("Some Description", categoryName: "Some Category")
Though, the automatic "Find X" actions of an AppEntity
are all added on top of the shortcuts list in no group.
So, is it possible to add a custom category name to an AppEntity
?
I found the solution in the „Explore enhancements to App Intents“ WWDC talk (at 28:27)!
Starting with iOS 17 you can add static findIntentDescription
var to your EntityQuery
like this:
struct MyIntentQuery: EntityPropertyQuery {
static var findIntentDescription: IntentDescription? {
IntentDescription(
"This is my intent description visible in the info sheet of the Shortcuts app.",
categoryName: "Category Name")
}
// …
}
In Apple’s example code Accelerating app interactions with App Intents they also show how to create those section headers with optional symbol for App Intents (accessible in the Shortcuts app overview). This is done by leveraging the parameterPresentation
option of the AppIntent()
This example creates a section title of „Favorite Trails“:
AppShortcut(intent: GetTrailInfo(), phrases: [
"Get \(\.$trail) conditions with \(.applicationName)",
"Get conditions on \(\.$trail) with \(.applicationName)"
],
shortTitle: "Get Conditions",
systemImageName: "cloud.rainbow.half",
parameterPresentation: ParameterPresentation(
for: \.$trail,
summary: Summary("Get \(\.$trail) conditions"),
optionsCollections: {
OptionsCollection(TrailEntityQuery(), title: "Favorite Trails", systemImageName: "cloud.rainbow.half")
}
))