let dateComponents = calendar.components(.DayCalendarUnit | .MonthCalendarUnit | .YearCalendarUnit, fromDate: date)
I got error:
'DayCalendarUnit' was deprecated in iOS version 8.0: Use NSCalendarUnitDay instead
But when I replace these names with those suggested by Apple
let dateComponents = calendar.components(NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear, fromDate: date)
I get error:
Use of unresolved identifier 'NSCalendarUnitDay'
Along with latest Swift 2.0:
NSCalendarUnit.Day
hence you will now have:
let dateComponents = calendar.components([NSCalendarUnit.Month, NSCalendarUnit.Day, NSCalendarUnit.Year], fromDate: date)
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