I've now removed the App Intents Extension and moved the code to the main target.
@available(macOS 13.0, *)
struct MyShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(intent: MyIntent(), phrases: ["Do something in \(.applicationName)"])
}
}
@available(macOS 13, *)
struct MyIntent: AppIntent {
static let title = LocalizedStringResource("intent.title")
static let description = IntentDescription("intent.description")
static let openAppWhenRun = true
@Parameter(title: "intent.parameter.first")
var first: String
@Parameter(title: "intent.parameter.second")
var second: String
func perform() async throws -> some IntentResult {
return .result()
}
}
I've also created AppShortcuts.xcstrings in the main target.
When I build the project, AppShortcuts.xcstrings only contains the string Do something in \(.applicationName), while all other strings (intent.title etc.) appear in Localizable.xcstrings. Is this expected?
Previously, when I still had the separate App Intents Extension, I had all those strings in the same file, but when I renamed it to AppShortcuts.xcstrings and moved it to the main target I got several errors
Invalid Utterance. Every App Shortcut utterance should have one '${applicationName}' in it.
The errors went away when I only kept the string
Do something in \(.applicationName), although I had to remove the others manually from the source code editor, since the string catalog editor always disables the buttons to add and remove strings in AppShortcuts.xcstrings.