I'm using NSYearCalendarUnit NSMonthCalendarUnit NSDayCalendarUnit but unfortunately, these "Calendar Units" are reported as deprecated first in IOS 8.0. What's the alternative of them, or how do I avoid these warnings.
unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
Use NSCalendarUnitYear:
NSCalendarUnit unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay; I infer from the code sample in the original question that you were looking for Objective-C answer, but for those looking for Swift equivalent, you would do:
let unitFlags: NSCalendarUnit = [.Year, .Month, .Day] Note, in Swift 3, the equivalent would be:
let unitFlags: Set<Calendar.Component> = [.year, .month, .day]
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