ios - -[NSDateComponents week] deprecated, which enum gives same behavior as before? -
the documentation nsdatecomponents says of ios 7, week deprecated , use weekofday or weekofyear instead.
if want same logic got when used week
, of these should use?
i have used in many places in code, thinking through each scenario cumbersome. if there 1 enum mapped same thing week did, save lot of time.
didn't find in documentation, have in code:
nsdatecomponents *todaycomps = [calendar components:nsyearcalendarunit | nsmonthcalendarunit | nsweekdaycalendarunit | nsweekcalendarunit fromdate:[nsdate date]];
when printed todaycomps.week console got 39.
so think should replace todaycomps.week todaycomps.weekofyear.
don't forget use nsweekofyearcalendarunit instead of nsweekcalendarunit.
good luck!
Comments
Post a Comment