IntentValueExpectation
A type that describes the value you expect for an intent parameter, an app entity property, or an intent result.
Declaration
protocol IntentValueExpectation : SendableOverview
A value expectation states a requirement on a single value, such as a string that contains a substring, or a value that’s absent. Pass value expectations to expect and result(_:) to build entity and intent expectations, or check a value directly with isSatisfied(by:). Intent parameters accept only ResolvableIntentValueExpectation values; see expect.
You get value expectations from the static members that the framework provides, such as contains(_:), isNil, and matches(_:requirement:), and from entity definitions and entity expectations. Don’t declare new conformances to this protocol.
For example, check whether an entity from an intent result has a title that contains a substring:
let event: AnyAppEntity = try result.value
let expectation = eventEntityDefinition.expect(title: .contains("NASA"))
let isSatisfied = try await expectation.isSatisfied(by: event)