summaryrefslogtreecommitdiffstats
path: root/Solsnu.Widget/Solsnu_WidgetBundle.swift
blob: 8a7b718a867af5ad0ef98e13a4127ead3fd64562 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
//  Solsnu_WidgetBundle.swift
//  Solsnu.Widget
//
//  Created by Ivar Løvlie on 15/12/2025.
//

import WidgetKit
import SwiftUI

@main
struct Solsnu_WidgetBundle: WidgetBundle {
    var body: some Widget {
        Solsnu_Widget()
        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])
    }
}