diff --git a/LaunchWidget/LaunchWidget.swift b/LaunchWidget/LaunchWidget.swift index ffac9d0..247bda6 100644 --- a/LaunchWidget/LaunchWidget.swift +++ b/LaunchWidget/LaunchWidget.swift @@ -76,7 +76,10 @@ struct CountdownMultiWidgetView: View { struct VoidView : View { var body: some View { - Text("Configure me!") + VStack { + Text("Tea!") + Text("4:00") + } } } @@ -89,9 +92,26 @@ struct LaunchWidgetEntryView : View { @ViewBuilder var body: some View { switch family { - case .systemSmall, .accessoryInline, .accessoryRectangular, .accessoryCircular: + case .systemSmall, .accessoryInline: + if let countdown = entry.countdowns.first { + CountdownSimpleWidgetView(countdown: countdown) + } else { + VoidView() + } + case .accessoryCircular: if let countdown = entry.countdowns.first { CountdownSimpleWidgetView(countdown: countdown) + .frame(maxWidth: .infinity, maxHeight: .infinity) + .background(Color.black) + } else { + VoidView() + } + case .accessoryRectangular: + if let countdown = entry.countdowns.first { + CountdownSimpleWidgetView(countdown: countdown) + .frame(maxWidth: .infinity, maxHeight: .infinity) + .background(Color.black) + .cornerRadius(16.0) } else { VoidView() } @@ -134,6 +154,8 @@ struct LaunchWidget_Previews: PreviewProvider { .previewContext(WidgetPreviewContext(family: .systemSmall)) LaunchWidgetEntryView(entry: SimpleEntry(countdowns: [fake, fake, fake, fake], date: Date(), configuration: SelectCountdownIntent())) .previewContext(WidgetPreviewContext(family: .systemMedium)) + LaunchWidgetEntryView(entry: SimpleEntry(countdowns: [fake], date: Date(), configuration: SelectCountdownIntent())) + .previewContext(WidgetPreviewContext(family: .accessoryRectangular)) } }