This implementation works very well for spotlight and App Shortcuts, but for voice commands by Siri, they don't work.
AppShortcutsProvider
import AppIntents
struct CustomerAppIntentProvider: AppShortcutsProvider {
@AppShortcutsBuilder static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: StoresAppIntent(),
phrases: ["Mostre as lojas do (.applicationName)"],
shortTitle: LocalizedStringResource("Lojas"),
systemImageName: "storefront"
)
}
}
Ex. do AppIntent
import AppIntents
import Foundation
import Loyalty
import ResourceKit
struct StoresAppIntent: AppIntent {
static var title: LocalizedStringResource = "Mostrar as lojas"
static var description: IntentDescription? = "Este atalho mostra as lojas disponiveis no app"
static var openAppWhenRun: Bool = true
static var isDiscoverable: Bool = true
@MainActor
func perform() async throws -> some IntentResult {
if let url = URL(string: “app://path") {
UIApplication.shared.open(url, options: [:], completionHandler: { (success) in
if success {
print("Opened \(url)")
} else {
print("Failed to open \(url)")
}
})
}
return .result()
}
}
Basically that's what I did
Our apps are with a minimum target of iOS 17 and I tested it on an iPhone 11 with Portuguese language and Siri in Portuguese
Selecting any option will automatically load the page