Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created July 3, 2024 07:39
Show Gist options
  • Save velotiotech/fa11a23fed4343783ec875bd011f531d to your computer and use it in GitHub Desktop.
Save velotiotech/fa11a23fed4343783ec875bd011f531d to your computer and use it in GitHub Desktop.
struct MonthlyHolidayWidget_Previews: PreviewProvider {
static var previews: some View {
// Provide a preview of the MonthlyHolidayWidgetEntryView for the widget gallery
MonthlyHolidayWidgetEntryView(entry: DayEntry(date: dateToDisplay(month: 12, day: 22), configuration: ConfigurationIntent()))
.previewContext(WidgetPreviewContext(family: .systemLarge))
}
// Helper function to create a date for the given month and day in the year 2024
static func dateToDisplay(month: Int, day: Int) -> Date {
let components = DateComponents(calendar: Calendar.current,
year: 2024,
month: month,
day: day)
return Calendar.current.date(from: components)!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment