7

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?

Naftali Beder
  • 1,066
  • 1
  • 10
  • 27

1 Answers1

0

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)))
    }
Tiago Mendes
  • 4,572
  • 1
  • 29
  • 35