Context
I built an app entirely using Swift Playgrounds on iPad (no access to a Mac / Xcode). The app is distributed via TestFlight and installed on an iPhone.
Problem
I implemented an AppShortcutsProvider with simple AppShortcut entries (code below), but no shortcuts show up in the Shortcuts app, in the list of apps with shortcuts, or via Siri.
What I've already tried without success:
Full restart of the iPhone
Deleting the app's data
Fully uninstalling and reinstalling the app
A new TestFlight build (with incremented build number) after adding the code
Confirming the phrases correctly include (.applicationName) as required
Question
Is the Extract AppIntentsMetadata build step (which generates the metadata.appintents file) actually executed when compiling/submitting via Swift Playgrounds on iPad, or is this a known limitation of the tool that would prevent App Shortcuts from being indexed by Shortcuts/Siri?
Provider code:
import SwiftUI import AppIntents
// ============================================================ // MARK: - TEST INTENT // ============================================================
struct TestExpenseIntent: AppIntent { static let title: LocalizedStringResource = "Test dépense"
static let description = IntentDescription(
"Teste l'intégration de l'application avec Raccourcis."
)
static let isDiscoverable = true
func perform() async throws -> some IntentResult {
return .result(dialog: "Ça fonctionne !")
}
}
// ============================================================ // MARK: - ADD EXPENSE INTENT // ============================================================
struct AddApplePayExpenseIntent: AppIntent { static let title: LocalizedStringResource = "Ajouter une dépense"
static let description = IntentDescription(
"Ajoute une dépense à un Tricount."
)
static let isDiscoverable = true
static let openAppWhenRun = false
@Parameter(title: "Montant")
var amount: Double?
@Parameter(title: "Marchand")
var merchant: String?
func perform() async throws -> some IntentResult {
let valAmount = amount ?? 0.0
let valMerchant = merchant ?? "Inconnu"
print("Montant :", valAmount)
print("Marchand :", valMerchant)
return .result(
dialog: "Dépense de \(valAmount) € chez \(valMerchant)."
)
}
}
// ============================================================ // MARK: - SHORTCUTS // ============================================================
struct MyAppShortcuts: AppShortcutsProvider {
static var shortcutTileColor: ShortcutTileColor = .blue
static let appShortcuts: [AppShortcut] = [
AppShortcut(
intent: TestExpenseIntent(),
phrases: [
"Tester (.applicationName)"
],
shortTitle: "Test dépense",
systemImageName: "plus.circle"
),
AppShortcut(
intent: AddApplePayExpenseIntent(),
phrases: [
"Ajouter une dépense dans (.applicationName)",
"Ajouter (.$amount) dans (.applicationName)"
],
shortTitle: "Ajouter une dépense",
systemImageName: "plus.circle"
)
]
}
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
App Intents
Shortcuts
Swift Playground
0
0
28