I have a very simple AppIntent
and AppShortcutsProvider
. It's working great in the Shortcuts app, but it just will not work when asking Siri.
// MARK: - OpenLibrary
struct OpenLibrary: AppIntent {
static let title: LocalizedStringResource = "Open Library"
static let description = IntentDescription("Opens your saved songs and playlists.")
static var openAppWhenRun: Bool = true
@MainActor
func perform() async throws -> some IntentResult & ReturnsValue {
if let url = URL(string: "appName://library/open") {
await UIApplication.shared.open(url)
}
return .result()
}
}
struct OpenLibraryShortcutsProvider: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: OpenLibrary(),
phrases: [
"Open Library in \(.applicationName)",
"Open \(.applicationName) Library",
"Open my library in \(.applicationName)",
"Open my \(.applicationName) Library"
],
shortTitle: "Open Library",
systemImageName: "rectangle.stack.fill"
)
}
static var shortcutTileColor: ShortcutTileColor = .lightBlue
}
I'm saying to Siri, on my iPhone, "Open my library in {appName}" and Siri responds with "{appName} hasn't added support for that with Siri". As I mentioned before, if I create and run this as a Shortcut, it works fine. The URL is handled correctly.
I'm just now learning AppIntent
. What can I try next?