// // JustOneThingWidget.swift // JustOneThing // // Created by Alan Francis on 11/06/2023. // import WidgetKit import SwiftUI import Intents @main struct JustOneThingWidgetBundle: WidgetBundle { var body: some Widget { JustOneThingWidget() } } struct JustOneThingWidgetEntryView : View { var entry: Provider.Entry var body: some View { Text(entry.date, style: .time) } } struct JustOneThingWidget: Widget { let kind: String = "JustOneThingWidget" var body: some WidgetConfiguration { IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, provider: Provider()) { entry in JustOneThingWidgetEntryView(entry: entry) } .configurationDisplayName("My Widget") .description("This is an example widget.") } } struct Widget_Previews: PreviewProvider { static var previews: some View { JustOneThingWidgetEntryView(entry: SimpleEntry(date: Date(), configuration: ConfigurationIntent())) #if os(watchOS) .previewContext(WidgetPreviewContext(family: .accessoryRectangular)) #else .previewContext(WidgetPreviewContext(family: .systemMedium)) #endif } }