1

I have a home widget with buttons (new in iOS 17). In order to prevent taking action if the user taps on the widget buttons accidentally, I want to ask the user for confirmation.

It appeared that requestConfirmation be exactly what I needed, but no confirmation view shows up when I invoke this method in the perform function.

I have tried the following:

        try await requestConfirmation(result: .result(dialog: "Are you sure you want to do this?") {
            Image(.mdlsWhite)
        })

and this alternative:

        let confirmed: Bool = try await $name.requestConfirmation(for: self.name,
                                                                         dialog: IntentDialog(stringLiteral: msg))

Neither option work.

I am starting to think that the requestConfirmation is not to be used with Home Widgets.

Is there a better way to handle confirmations for buttons included in a Home Widget?

RawMean
  • 8,374
  • 6
  • 55
  • 82

0 Answers0