![見出し画像](https://assets.st-note.com/production/uploads/images/146928759/rectangle_large_type_2_1fdfc1a2d3e273322f4bfe586f9883fd.jpeg?width=1200)
AppIntentsでインテントを実行する前にユーザーに尋ねる
requestConfirmation()とは
この関数を使うとPerform()の前にDialogなどを出してユーザーに尋ねることができる。
https://developer.apple.com/documentation/appintents/appintent/requestconfirmation()
以下のビデオで例として紹介されていていたのは、本を買うというインテントの途中で値段や本の情報のView,Dialogとともに、注文するかを決定するボタンを表示するものだった。(26:23)
https://developer.apple.com/jp/videos/play/wwdc2022/10032
内容
iOS18からはrequestConfirmation(conditions:actionName:dialog:)の形で書く必要がある。
conditions
actionName
ボタンの名前を指定する。名前はStringで自由に決められるのではなく、テンプレートのようなものの中から選ぶ。
https://developer.apple.com/documentation/appintents/confirmationactionname
dialog
表示、読み上げられる文章を指定する。
この記事が気に入ったらサポートをしてみませんか?