init(_:_:_:_:otherwise:)
Creates a When condition checking if a union value parameter matches any case in a list.
Declaration
init<ValueType, Parameter>(_ keyPath: KeyPath<Intent, Parameter>, _ comparisonOperator: OneOfComparisonOperator, _ values: [ValueType.ValueType.Cases], @ParameterSummaryBuilder<Intent> _ when: () -> WhenCondition, @ParameterSummaryBuilder<Intent> otherwise: () -> Otherwise) where ValueType == Parameter.Value, Parameter : AnyIntentValue, ValueType.ValueType : AppUnionValueParameters
- keyPath:
Key path to the union value parameter
- comparisonOperator:
The comparison operator (
.oneOfor.noneOf) - values:
The array of union value cases to check against
- when:
The summary to use when the condition is true
- otherwise:
The summary to use when the condition is false
Discussion
Example:
When(\.$reaction, .oneOf, [.text, .emoji]) {
Summary("Text-based reaction")
} otherwise: {
Summary("Other reaction type")
}