How to show correct title for intents in Spotlight

In my plant watering app, I created a PlantEntity and a WaterPlantIntent that edits the plant to mark it as watered. PlantEntity conforms to AppEntity and IndexedEntity. I also created OpenPlantIntent that conforms to OpenIntent.

My AppShortcutsProvider is implemented like so:

struct ShortcutsProvider: AppShortcutsProvider {
    static var appShortcuts: [AppShortcut] {
        return [
            AppShortcut(
                intent: WaterPlantIntent(),
                phrases: [
                    "Water plant in \(.applicationName)",
                    "Water \(\.$plantEntity) in \(.applicationName)"
                ],
                shortTitle: "Water Plant",
                systemImageName: "drop.fill"
            )
        ]
    }
}

Now, when I search in Spotlight for a plant name, two results are shown but both are titled the name of the plant. The one in the App Name section just opens the plant in the app but the one in the Top Hit section actually performs the WaterPlantIntent! There's no indication that would occur. I expected it to be titled Water Plant Name so users know what shortcut is being run.

Is there a way I can configure my code to show the proper title here?

Answered by Frameworks Engineer in 891871022

We would love a feedback for this, as I agree this duplication is unfortunate. I would recommend that you choose whether the more valuable experience for your app is WaterPlantIntent or the simple OpenIntent. If you just want WaterPlantIntent, remove your Spotlight indexing code. If just want the OpenIntent, remove your App Shortcut.

We would love a feedback for this, as I agree this duplication is unfortunate. I would recommend that you choose whether the more valuable experience for your app is WaterPlantIntent or the simple OpenIntent. If you just want WaterPlantIntent, remove your Spotlight indexing code. If just want the OpenIntent, remove your App Shortcut.

I heard at one point AppShortcutParameterPresentation should address this, but was never able to get it to update. Is that incorrect?

Are you also calling updateAppShortcutParameters()

This is needed for AppShortcuts. The results you are seeing in Spotlight may be coming from the IndexEntity donation.

How to show correct title for intents in Spotlight
 
 
Q