AppIntents

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 perforrm method
struct Statistics {
    var countA: Int
    var countB: Int
    var countC: Int
}

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

func perform() async throws -> some IntentResult & ReturnsValue<Statistics> {
...
...
}

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)? (defaultQuery would never be used.)
  3. What is the correct way tackle this?
AppIntents
 
 
Q