Hello,
I have written the following app intent and I can access it via shortcuts. But I can't get Siri to pick it up. I want it to have a dynamic book title (which could be anything) so that the user can say "Add (bookname) to my (app name). I need it to work for ios 17.1 onwards. I have added siri as a capability for my ios app.
import AppIntents
struct AddBookToReadingListIntent: AppIntent {
static var title: LocalizedStringResource = "Add my Book"
@Parameter(title: "Book Title", requestValueDialog: "What's the title of the book you want to add?")
var bookTitle: String
static var parameterSummary: some ParameterSummary {
Summary("Add my '\(\.$bookTitle)'")
}
func perform() async throws -> some IntentResult & ReturnsValue<String> {
return .result(value: "Added '\(bookTitle)' to your app")
}
}
struct AppShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: AddBookToReadingListIntent(),
phrases: [
"Add \(\.$bookTitle) in \(.applicationName)"
],
shortTitle: "Add Book to app name",
systemImageName: "book"
)
}
}