Z S
Z S

Reputation: 7471

iOS SiriKit: passing data between Intents 'resolve' and 'handle' methods

I am trying out the new iOS13 SiriKit Intents with Customizable Parameters. It's working fine ... I have multiple parameters, and the 'resolve' method is called for each of them, and then the 'confirm', and then the 'handle' as expected. But I'm having trouble with keeping and passing 'state' between these multiple calls. When the first parameter is resolved, I want to store some extra information about the resolution, so it can be used in 'handle'. I was planning to use the IntentsHandler object to keep this state, but apparently a new IntentsHandler object is instantiated with each 'resolve' call, so that doesn't work.

What other ways could we pass 'state' between the 'resolve' and 'confirm' / 'handle' methods, which is relevant while one Siri 'transaction' is on-going?

Upvotes: 0

Views: 334

Answers (1)

mawus
mawus

Reputation: 1198

You can use a singleton instance of an external class, a service / manager in the IntentsHandler in which you can keep your state or extra information needed

Upvotes: 2

Related Questions