Hi, I'm trying to add Shortcuts using AppIntents but unable to get past this error:
'AppShortcutsProvider' property 'appShortcuts' requires builder syntax
This is the AppShortcutsProvider struct:
import AppIntents
struct MyAppShortcuts: AppShortcutsProvider {
@AppShortcutsBuilder
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: OpenDashboardIntent(),
phrases: [
"Open dashboard in \(.applicationName)",
"Show my \(.applicationName) dashboard"
],
shortTitle: "Open Dashboard",
systemImageName: "square.grid.2x2"
)
}
}
And I have only one intent:
import AppIntents
struct OpenDashboardIntent: AppIntent {
static var title: LocalizedStringResource = "Open Dashboard"
static var openAppWhenRun: Bool = true
@MainActor
func perform() async throws -> some IntentResult & ProvidesDialog {
return .result(dialog: "Opening dashboard")
}
}
I searched the error online but the fixes were to use @AppShortcutsBuilder and skipping commas in case of registering multiple app intents - I'm already following all that.
What am I missing?
Thanks.