Skip to content

Instantly share code, notes, and snippets.

@HunterHillegas
Last active September 11, 2022 15:48
Show Gist options
  • Save HunterHillegas/92839a14c2b24572f6ff2aca0460f3c5 to your computer and use it in GitHub Desktop.
Save HunterHillegas/92839a14c2b24572f6ff2aca0460f3c5 to your computer and use it in GitHub Desktop.
import AppIntents
// Compiles but does not work
struct VegasMateShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
return [
AppShortcut(intent: ViewNextTripIntent(), phrases: [
"View my next trip in \(.applicationName)",
"View my next Vegas trip in \(.applicationName)",
"Show my \(.applicationName) trips"
]),
AppShortcut(intent: AddHotelToTripIntent(), phrases: [
"Add a hotel to my trip in \(.applicationName)",
]),
AppShortcut(intent: RecordWinOrLossIntent(), phrases: [
"Record a win or less in \(.applicationName)"
])
]
}
}
// This works - note the builder syntax instead of the array
struct VegasMateShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(intent: ViewNextTripIntent(), phrases: [
"View my next trip in \(.applicationName)",
"View my next Vegas trip in \(.applicationName)",
"Show my \(.applicationName) trips"
])
AppShortcut(intent: AddHotelToTripIntent(), phrases: [
"Add a hotel to my trip in \(.applicationName)",
])
AppShortcut(intent: RecordWinOrLossIntent(), phrases: [
"Record a win or less in \(.applicationName)"
])
}
}
@HunterHillegas
Copy link
Author

The above will compile but won't work. Use builder syntax instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment