I’m currently following a tutorial to develop an iOS interactive widget. Basically, in my widget, I want to have a button that users can tap on to record a number. Ideally, I would like it to prompt the dialog with the number input field. In my research, I came across something called requestValueDialog
that I can include in my parameters defined in the AppIntent
class, so I thought this is how it’s done.
struct MinimalIntent:AppIntent{
static var title: LocalizedStringResource = "Number Recorder"
@Parameter(title:"Number", requestValueDialog: IntentDialog("Enter number")) // HERE
var value: Int
func perform() async throws -> some IntentResult {
// do sth
return .result()
}
}
Unfortunately, while it works fine when I launch the app intent from shortcuts, it doesn’t seem to work with my widget.
So, is there an actual way to do this that I don’t know, or are we just not supposed to do it this way?