Search code examples
swiftxcodesirishortcuts

Xcode Siri Intents: How to pass a variable from Intent Handler to IntentUI ViewController without including it in the response


I need to pass a variable from the Intent Handler to the IntentViewController WITHOUT including it in the Response, so that it is displayed in the custom UI without Siri having to say it.

So far I have only been able to pass them using the Response like this:

completion(GetTimesIntentResponse.success(name: "SomeName", time: "5:40", location: LatestLocation.City))

However, this means Siri has to say this as part of the Response. All I want is for location to be displayed in a label (in the Custom UI) without Siri having to read it out.


Solution

  • I didn't manage to find a way to do this directly, however the workaround is to save the variable(s) to Core Data in the Intent Handler and fetch them in the IntentViewController. It is only a workaround, but effective in my case, as was only a single variable I needed to pass and was already storing it in Core Data elsewhere the App anyway.