AppIntent's perform method to return custom type
06:18 30 Dec 2025

Overview

  • I have a custom type `Statistics` that has 3 properties inside it
  • I am trying to return this as part of the AppIntent's `perform` method
struct Statistics {
    var countA: Int
    var countB: Int
    var countC: Int
}

I would like to implement the AppIntent to return `Statistics` as follows:

Problem

  • It doesn't make much sense to make Statistics as an `AppEntity` as this is only computed as a result.
  • Statistics doesn't exist as a persisted entity in the app.

Questions

  1. How can I implement Statistics?
  2. Does it have to be AppEntity (I am trying to avoid this)?
  3. What is the correct way tackle this?
ios swift appintents