'DatePicker Highlight Only One Weekday
Ok so, below is the code, I'm trying to adapt apple's code to show only 1 weekday (the weekday the app was launched) every week, right now I can nail down a span of x days, but I'm trying to get 1 day each week to appear and the rest to be blocked out:
let dateRange: ClosedRange<Date> = {
let calendar = Calendar.current
let startComponents = DateComponents(year: 2022, month: 5, day: 1)
let endComponents = DateComponents(year: 2022, month: 5, day: 12)
return calendar.date(from:startComponents)!
...
calendar.date(from:endComponents)!
}()
DatePicker("Date", selection: $date, in: dateRange, displayedComponents: [.date])
.datePickerStyle(CompactDatePickerStyle())
.labelsHidden() // dateRange called from in:
Any ideas? Kind of new to dates, it's heavy
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
