I updated Xcode a couple weeks ago and started getting a warning on this line:
let weekdayComponent = currentCalendar?.components(.WeekdayCalendarUnit, fromDate: date)
'WeekdayCalendarUnit' was deprecated in iOS version 8.0: Use NSCalendarUnitWeekday instead
But when I replace .WeekdayCalendarUnit
with .NSCalendarUnitWeekday
, I get a "could not find member .NSCalendarUnitWeekday" error. I tried a few other varieties but no luck.
What should we be using instead?
A little tricky. Check the format. Here you go:
let weekdayComponent = currentCalendar?.components(NSCalendarUnit.CalendarUnitWeekday, fromDate: date)
Or:
let weekdayComponent = currentCalendar?.components(.CalendarUnitWeekday, fromDate: date)
I was able to find the right format in the NSCalendar Class Reference