swift – Parameterized App Shortcut isn’t displaying up accurately in Highlight (iOS 17)

Spread the love

I’m engaged on supporting iOS 17’s new Shortcuts options. I’ve a a number of App Shortcuts together with one which launches the app in a particular tab. The tab choice is finished through a customized AppView enum that conforms to the AppEnum protocol.

The issue is that for some motive the open in view XYZ motion doesn’t present accurately in Highlight. As you possibly can see within the screenshot under it doesn’t have any icon or title. Additionally within the Shortcuts app itself solely the Motion ensuing from the primary phrase exhibits up. The AppView primarily based phrase actions solely present up as previous App Shortcuts under.

Any concept the way to repair that concern?

App Shortcuts Definition

struct AppShortcuts: AppShortcutsProvider {
    static var shortcutTileColor: ShortcutTileColor = .grape
    static var appShortcuts: [AppShortcut] {
            intent: OpenAppIntent(),
            phrases: [
                "Open (.applicationName)",
                "Open (.$view) in (.applicationName)"
            shortTitle: "Open",
            systemImageName: "arrow.up.ahead.app"
        // Different App Shortcuts …

AppView App Enum

extension AppView: AppEnum {
    static var typeDisplayRepresentation = TypeDisplayRepresentation(title: "View")
    static var caseDisplayRepresentations: [Self : DisplayRepresentation] = [
        .insights: DisplayRepresentation(title: LocalizedStringResource("Insights", table: "Shortcuts", comment: "App View Label"),
                                         image: .init(systemName: "chart.xyaxis.line")),
        .events: DisplayRepresentation(title: LocalizedStringResource("Events", table: "Shortcuts", comment: "App View Label"),
                                       image: .init(systemName: "calendar")),
        .meters: DisplayRepresentation(title: LocalizedStringResource("Meters", table: "Shortcuts", comment: "App View Label"),
                                       image: .init(systemName: "barometer"))

Shortcut Definition

struct OpenAppIntent: AppIntent {
    // Launches app when motion is triggered
    static let openAppWhenRun: Bool = true
    // App View Parameter
    @Parameter(title: "View",
               description: "The view contained in the app.",
               default: .insights,
               requestValueDialog: IntentDialog("The place would you prefer to navigate to?"))
    var view: AppView
    // Title, Description, Parameter Abstract & carry out()


App Shortcuts in Spotlight
App Shortcuts in the Shortcuts App

Leave a Reply

Your email address will not be published. Required fields are marked *