Closed thecoolwinter closed 4 years ago
Hi @thecoolwinter - I need an FAQ for this question since it gets asked quite a bit 😛
The short answer - those are intentionally internal to prevent you from making a Day
using the wrong Calendar
object (which would result in a Day
that is incompatible with other Day
s).
If you want to make a certain day appear selected, you can do so in your dayItemProvider
closure. You can convert the provided Day
to a Date
by doing let date = calendar.date(from: day.dateComponents)!
. Then, you can use any of the standard Calendar
functions to compare Date
s. For example, you could check whether a particular date is "today" and return a different, highlighted calendar item if that condition is true.
More context here: https://github.com/airbnb/HorizonCalendar/pull/28
I'd like to have a CalendarView and a UIDatePicker on the same screen, and be able to initialize the CalendarView with a selected day already provided. Without the user having to select a date.
When trying to create a new
Day
object I get the error: "'Day' initializer is inaccessible due to 'internal' protection level". So, I tried adding apublic init() {}
to the Day object with some initial values, but it still is giving the error. The same error happens with theMonth
object.I would just make a public init on the Day and Month objects and it would fix my problem, but it's still giving the error.