struct StaticWidgetEntryView :View {
var entry: Provider.Entry
@Environment(\.widgetFamily) var family
@ViewBuilder
var body : some View {
switch family {
case .systemSmall:
SmallWidgetEntryView(entry: entry)
case .systemMedium:
MediumWidgetEntryView(entry: entry)
case .systemLarge:
LargeWidgetEntryView(entry: entry)
case .systemExtraLarge:
fatalError()
case .accessoryCircular:
fatalError()
case .accessoryRectangular:
fatalError()
case .accessoryInline:
fatalError()
@unknown default:
fatalError()
}
}
}
struct WaterGlassWidget: Widget {
let kind: String = "MyApp"
var body: some WidgetConfiguration {
IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, provider: Provider()) { entry in
StaticWidgetEntryView(entry: entry)
}
.configurationDisplayName("MyApp")
.description("progress widget small")
.supportedFamilies([.systemSmall, .systemMedium, .systemLarge])
}
}