diff options
Diffstat (limited to 'Solsnu.Widget')
| -rw-r--r-- | Solsnu.Widget/Solsnu_Widget.swift | 13 | ||||
| -rw-r--r-- | Solsnu.Widget/Solsnu_WidgetBundle.swift | 45 |
2 files changed, 51 insertions, 7 deletions
diff --git a/Solsnu.Widget/Solsnu_Widget.swift b/Solsnu.Widget/Solsnu_Widget.swift index 980725e..78ad05b 100644 --- a/Solsnu.Widget/Solsnu_Widget.swift +++ b/Solsnu.Widget/Solsnu_Widget.swift @@ -18,7 +18,7 @@ struct Provider: TimelineProvider { completion(entry) } - func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) { + func getTimeline(in context: Context, completion: @escaping (Timeline<SolvervEntry>) -> ()) { var entries: [SolvervEntry] = [] let currentDate = Date() @@ -67,21 +67,22 @@ struct Solsnu_WidgetEntryView : View { } struct Solsnu_Widget: Widget { - let kind: String = "Solsnu_Widget" + let kind: String = "Solsnu_Widget_Small" var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: Provider()) { entry in if #available(iOS 17.0, *) { - Solsnu_WidgetEntryView(entry: entry) + SmallWidgetView(entry: entry) .containerBackground(.fill.tertiary, for: .widget) } else { - Solsnu_WidgetEntryView(entry: entry) + SmallWidgetView(entry: entry) .padding() .background() } } - .configurationDisplayName("My Widget") - .description("This is an example widget.") + .configurationDisplayName("Solstice Countdown") + .description("Days until next solstice or equinox") + .supportedFamilies([.systemSmall]) } } diff --git a/Solsnu.Widget/Solsnu_WidgetBundle.swift b/Solsnu.Widget/Solsnu_WidgetBundle.swift index 24e5cbe..8a7b718 100644 --- a/Solsnu.Widget/Solsnu_WidgetBundle.swift +++ b/Solsnu.Widget/Solsnu_WidgetBundle.swift @@ -12,6 +12,49 @@ import SwiftUI struct Solsnu_WidgetBundle: WidgetBundle { var body: some Widget { Solsnu_Widget() - Solsnu_WidgetControl() + Solsnu_WidgetMedium() + Solsnu_WidgetLarge() + } +} + +// Medium widget +struct Solsnu_WidgetMedium: Widget { + let kind: String = "Solsnu_Widget_Medium" + + var body: some WidgetConfiguration { + StaticConfiguration(kind: kind, provider: Provider()) { entry in + if #available(iOS 17.0, *) { + MediumWidgetView(entry: entry) + .containerBackground(.fill.tertiary, for: .widget) + } else { + MediumWidgetView(entry: entry) + .padding() + .background() + } + } + .configurationDisplayName("Solstice Countdown") + .description("Days until next solstice or equinox") + .supportedFamilies([.systemMedium]) + } +} + +// Large widget +struct Solsnu_WidgetLarge: Widget { + let kind: String = "Solsnu_Widget_Large" + + var body: some WidgetConfiguration { + StaticConfiguration(kind: kind, provider: Provider()) { entry in + if #available(iOS 17.0, *) { + LargeWidgetView(entry: entry) + .containerBackground(.fill.tertiary, for: .widget) + } else { + LargeWidgetView(entry: entry) + .padding() + .background() + } + } + .configurationDisplayName("Solstice Countdown") + .description("Days until next solstice or equinox") + .supportedFamilies([.systemLarge]) } } |
