App Intents @Parameter with one-sided inclusive range (no upper bound)

286 Views Asked by At

I want to define an AppIntent/Shortcut with a number @Parameter (of type double) that has a defined range. The range should be one-sided to only include positive numbers. Basically like the Swift range: 0...

The @Parameter uses the inclusiveRange type alias for int/double variables …
Though, how do I define such a one-sided open range?

My current hack is to simply include a very large number in the upperBound, but there has to be a better way.

@Parameter(title: "Reading",
           description: "The numeric value of the reading.",
           controlStyle: .field,
           inclusiveRange: (lowerBound: 0, upperBound: 100000000),
           requestValueDialog: IntentDialog("What is the numeric value of the reading?"))
var value: Double
0

There are 0 best solutions below