Specify "Ask Each Time" as default for a parameter in Siri intent

Published

When displaying an instance of INUIAddVoiceShortcutViewController, I want to let one of the shortcut’s intent’s parameters (of type Decimal) default to Ask Each Time.

Right now, it defaults to the Default Value value in the .intentdefinition file. (This field resets to 0 if left blank.)

Is there any way to define an intent such that when it’s instantiated in a shortcut, it has a parameter that defaults to Ask Each Time?

Source: Ios

Published
Categorised as ios, sirikit, sirishortcuts

Answers

You can set the default value a not accept number that is not in the minimum and max.

print screen

And then also use the “resolve” function to validate and ask for the value using “.needsValues”

func resolveLevel(for intent: BrightnessSetIntent, with completion: @escaping (BrightnessSetLevelResolutionResult) -> Void) {
        
        guard let deviceIntent = intent.level else {
            completion(BrightnessSetLevelResolutionResult.needsValue())
            return
        }

        completion(BrightnessSetLevelResolutionResult.success(with: Int(truncating: deviceIntent)))
    }

Florencio Quigley

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq