I wish to create my very own AppShortcut so I can seek for my app and its contents on Highlight. At present I’ve these codes:
import AppIntents
@obtainable(iOS 16.0, *)
struct TransferIntent: AppIntent {
static var title = LocalizedStringResource("Switch cash.")
static var openAppWhenRun = true
static var isDiscoverable = true
func carry out() async throws -> some IntentResult & ProvidesDialog {
NavigationManager.shared.navigate(to: .transferMoney)
return .consequence(dialog: IntentDialog("Open app to switch cash."))
}
}
import AppIntents
@obtainable(iOS 16.0, *)
struct OmniAppShortcutsProvider: AppShortcutsProvider {
@AppShortcutsBuilder
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: TransferIntent(),
phrases: [
"Transfer money with (.applicationName)",
"Kirim uang dengan (.applicationName)"
],
shortTitle: "Switch cash",
systemImageName: "banknote.fill"
)
}
}
class AppDelegate: UIResponder, UIApplicationDelegate {
func software(_ software: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
setupAppsFlyer()
if #obtainable(iOS 16.0, *) {
OmniAppShortcutsProvider.updateAppShortcutParameters()
}
...
}
The shortcut reveals up on Shortcuts app. However after I tried looking with Highlight, it does not present up. How do I present it on Highlight?
Thanks.
