App Intent definition changed but not synced to Shortcuts app

I'm changing an App Intent definition but the changes are not reflected in the Shortcuts app when I try to use my changed intent as an action in a Shortcut.

And trying to run the shortcut gives an exception:

[Execution] perform() returned types not declared in method signature

AppIntents/PerformActionExecutorTask.swift:78: Fatal error: perform() returned types not declared in method signature

Is there a way to force reload the Shortcuts app to get the new intents or am I missing something more basic?

Accepted Reply

I figured it out. When returning a result together with a value the return definition of the perform() function needs to include IntentResult like so:

// Works as described ✅
func perform() async throws -> some IntentResult & ReturnsValue<String> {
    return .result(value: "Some text")
}

Including just ReturnsValue<String> will result in the exception above and modified version of the intent will nob be picked up by the compiler.

// Incorrect function annotation ❌
func perform() async throws -> some ReturnsValue<String> {
    return .result(value: "Some text")
}

Replies

I figured it out. When returning a result together with a value the return definition of the perform() function needs to include IntentResult like so:

// Works as described ✅
func perform() async throws -> some IntentResult & ReturnsValue<String> {
    return .result(value: "Some text")
}

Including just ReturnsValue<String> will result in the exception above and modified version of the intent will nob be picked up by the compiler.

// Incorrect function annotation ❌
func perform() async throws -> some ReturnsValue<String> {
    return .result(value: "Some text")
}