requestConfirmation(conditions:actionName:dialog:showDialogAsPrompt:snippetIntent:)
Displays a confirmation prompt with an interactive snippet.
Declaration
@discardableResult func requestConfirmation<Snippet>(conditions: ConfirmationConditions = [], actionName: ConfirmationActionName = .`continue`, dialog: IntentDialog? = nil, showDialogAsPrompt: Bool = true, snippetIntent: Snippet) async throws -> Snippet.PerformResult.Value where Snippet : SnippetIntent, Snippet.PerformResult : ReturnsValueParameters
- conditions:
The conditions to check before asking for confirmation.
- actionName:
The action associated with the request. The system puts the action name in the button that confirms the action.
- dialog:
The localized text you want the confirmation request to display or speak.
- showDialogAsPrompt:
trueto include the contents of thedialogparameter in the confirmation interface. Specifyfalseto omit the dialog from the interface. - snippetIntent:
The snippet to display in the confirmation interface.
Return Value
The return value from the snippet.
Discussion
Call this method when you want someone to confirm a particular choice. For example, call this method before someone performs an action that might be destructive or unsafe. The method displays a confirmation interface that includes the provided snippet and optional dialog text. The interface asks the person to confirm or cancel the operation, and returns normally if the person confirms the operation. If the person chooses the cancel option, the method throws an error.
The code that shows your snippet can potentially modify parameter values in your app intent type. After this function returns, retrieve the latest values from properties instead of relying on cached versions of that data.