Widget Intent Definition: Can I define a parameter with multiple values that has fixed size 0 for small widget?

My widget's layout is like:

Code Block swift
/* Small */
HStack {
BigItemA
BigItemB
}
/* Medium */
VStack {
HStack {
BigItemA
BigItemB
}
HStack {
SmallItemA
SmallItemB
SmallItemC
}
}


I want to configure this widget in this way:
Code Block
/* Small */
BigItemA -> What?
BigItemB -> What?
/* Medium */
BigItemA -> What?
BigItemB -> What?
SmallItemA -> What?
SmallItemB -> What?
SmallItemC -> What?


So I add two parameters in my custom intent, and checked Supports multiple values and Fixed size.

For big items, everything is ok, I just set array size to be 2 at every widget size.

However, for the small items, when I make the array size to be 0 in small widget size, I get an alert: Array size must be a positive number.

How can I implement this requirement in intent definition?

Accepted Reply

Just find this question here, that also answers my question: https://developer.apple.com/forums/thread/653863

A widget must either have an IntentConfiguration or a StaticConfiguration, so you can't do exactly what you're describing with just one widget. You can accomplish a similar effect by making two widgets that use the same implementation for their timeline provider and view methods, and provide both of them with a WidgetBundle.


Replies

Just find this question here, that also answers my question: https://developer.apple.com/forums/thread/653863

A widget must either have an IntentConfiguration or a StaticConfiguration, so you can't do exactly what you're describing with just one widget. You can accomplish a similar effect by making two widgets that use the same implementation for their timeline provider and view methods, and provide both of them with a WidgetBundle.