1

I'm creating a custom intent using the AppIntents framework. I've set up my intent to return a result with some data so I can use it in other shortcuts. When I use the output result as the input to another action, it shows the title field as the output:

struct MyIntent: AppIntent {
    static var title: LocalizedStringResource = "This is the title"
    static var description = IntentDescription("This is the description.")
    
    static var parameterSummary: some ParameterSummary {
        Summary("This is the parameter summary")
    }
    
    func perform() async throws -> some IntentResult {
        return .result(value: true)
    }
}

First action: "This is the parameter summary"; second action: "If (This is the title)"

The title field is also used in the list of possible actions, so I'd like to keep it as is. However, I don't like the look of the description being used for the output result (in this case, the "If (This is the title)" part). I can see with other built-in actions that it's possible to set these separately; for example, the "Match Text" action lists "Matches" as the output. Is there a way to change just the output label while leaving the title the same?

JBYoshi
  • 258
  • 2
  • 6

1 Answers1

1

You can specify the result value name in the IntentDescription initializer, new in iOS 17:

import AppIntents

@available(iOS 17.0, *)
struct MyIntent: AppIntent {
    static var title: LocalizedStringResource = "This is the title"
    static var description = IntentDescription("This is the description.", resultValueName: "My Result")
    
    static var parameterSummary: some ParameterSummary {
        Summary("This is the parameter summary")
    }
    
    func perform() async throws -> some IntentResult & ReturnsValue<Bool> {
        return .result(value: true)
    }
}

Shortcuts screenshot

Jordan H
  • 52,571
  • 37
  • 201
  • 351