I am trying to implement a variable configuration for my WidgetBundle. For example, I would like to have a widget only available for certain customers. The general idea would be some like this like:
I realize that this particular syntax is invalid, but I've tried all manner of Function builder syntaxes I could think of to make something like this work but haven't been able to get any to work for widgets. In SwiftUI we have the conditional function builders, but I can't quite discover if they don't exist here or I'm just missing them.
Is this type of configurability possible? Thank you!
Code Block Swift @main struct Widgets: WidgetBundle { @WidgetBundleBuilder var body: some Widget { if Membership.active? { WidgetA() WidgetB() WidgetPremium() } else { WidgetA() WidgetB() } } }
I realize that this particular syntax is invalid, but I've tried all manner of Function builder syntaxes I could think of to make something like this work but haven't been able to get any to work for widgets. In SwiftUI we have the conditional function builders, but I can't quite discover if they don't exist here or I'm just missing them.
Is this type of configurability possible? Thank you!