@available(iOS 18.0, *)
@AssistantIntent(schema: .system.search)
struct SearchIntent: AppIntent {
static let title: LocalizedStringResource = "Search <app name redacted>"
static let searchScopes: [StringSearchScope] = [.general]
@Parameter(title: "Criteria")
var criteria: StringSearchCriteria
@MainActor
func perform() async throws -> some IntentResult {
MyDependencyManager.shared.performSearch(with: criteria.term)
return .result()
}
}
// In AppShortcutProvider
AppShortcut(
intent: SearchIntent(),
phrases: [
"Find \(\.$criteria) in \(.applicationName)",
"Search for \(\.$criteria) in \(.applicationName)",
],
shortTitle: "Search <app name redacted>",
systemImageName: "magnifyingglass"
)
The search works when using the Shortcuts app, but not when using Siri. For example if I ask Siri "Search for <thing> in <app name>" it just does a Google search or prompts me to install the app from the App Store (I am running a debug build via Xcode). I can't get this to work from Spotlight either.
I am using Xcode 16 and running the app on an iPhone 16 with OS 18.2 beta and Apple Intelligence turned on.
What am I doing wrong here? I cannot find any other information about this intent or how to properly set it up and use it.