Upgrade to Pro — share decks privately, control downloads, hide ads and more …

App Intentsを実装しよう

App Intentsを実装しよう

yidev 横浜iPhone開発者勉強会 第4部 - 第31回勉強会

Avatar for 野瀬田 裕樹

野瀬田 裕樹

August 09, 2026

More Decks by 野瀬田 裕樹

Other Decks in Programming

Transcript

  1. AppIntentの実装 • AppIntentプロトコルで必要な分を実装するだけ protocol AppIntent : … { associatedtype PerformResult

    : IntentResult static var title: LocalizedStringResource { get } static var openAppWhenRun: Bool { get } static var supportedModes: IntentModes { get } static var authenticationPolicy: IntentAuthenticationPolicy { get } static var isDiscoverable: Bool { get } associatedtype SummaryContent : ParameterSummary static var parameterSummary: Self.SummaryContent { get } static var description: IntentDescription? { get } func perform() async throws -> Self.PerformResult
  2. AppIntentのプロパティ func perform() async throws -> some IntentResult? • App

    Intentsが実行されたときに呼び出される関数 • 返り値も設定できる
  3. 関連する公式ドキュメント • Apple IntelligenceとSiriに状況に応じた情報を提供する https://developer.apple.com/documentation/appintents/providing-contextual-cues-to-apple-intelligence-and-siri • 色々な追加情報の渡し方を説明してくれている • あるAppEntityがどういうデータなのか? •

    画面認識で「これを〜〜して」の「これ」は何? • などをシステムに理解してもらうための工夫が記載されている • Transferable, ValueRepresentation, appEntityIdentifier(̲:), appEntityUIElements(̲:) などが気になったら読む
  4. 関連する公式ドキュメント • Apple Intelligence がアクションやコンテンツを検出できるよ うにする https://developer.apple.com/documentation/appintents/making-actions-and-content-discoverable-by-apple-intelligence • AppIntent, AppEntity,

    AppEnumのschemaの説明 • AppIntentなどがどのような時に使われるべきかを指定できる • @AppIntent(schema: .photos.openAsset)のような schemaが何者なのかが知りたくなったら読む
  5. Swift PMと相性悪い問題 • • WWDC25でSwift Packageに対応したよ! と言っていたがうまく動かない • 普通にアプリと別のTargetに分離したframeworkにする分には動く •

    一回だけちゃんと登録されたことがある (が、その後更新しても反映されなかったりして不安定) • 個人の環境の問題なのか、実機では問題ないのかは不明 誰か答え持ってたら教えてください
  6. Default MainActorと相性悪い問題 • Swift 6 x Strict Concurrency Checking=complete x

    Default Actor Isolation=MainActor の組み合わせで AppIntent の @Parameter が定義できない (swiftlang/swift/issues/76725) • AppIntentのコードに関してはDefault Actor Isolation設定をや めましょう