I'm looking for an example where + autoupdatingCurrentCalendar
would be used instead of + currentCalendar
. More specifically where the values based on the calendar are automatically changed when the calendar changes. Do I need bindings for this or something like that?
The docs state:
Note that if you cache values based on the calendar or related information those caches will of course not be automatically updated by the updating of the calendar object.
Thanks in advance
currentCalendar
returns cached version of current system calendar, while autoupdatingCurrentCalendar
always returns most recent version of system calendar.
That is important, when you are presenting data based on the various parameters of a calendar like number of days in a month, number of a weeks in year or number of hours in a day.
To be honest, I don't know why Apple gives you an opportunity to get outdated value by using currentCalendar
.
It looks like they have internal API that allows you to manipulate caches of NSCalendar
, so you can achieve better performance. But since it is not public, there is no reason to use currentCalendar
.
That is, always use autoupdatingCurrentCalendar
.
Well, on OS X you can be running multiple processes simultaneous. One could be your process that uses the autoupdatingCurrentCalendar
. The other could be System Preferences.
System Preferences allows you to customize your calendar settings. You can choose the first day of the week to be something other than the default (Sunday). Or you can choose a whole different calendar altogether. If you use the autoupdatingCurrentCalendar
, these changes will be picked up automatically. If you don't use it, they won't.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With