The key is in the definition of the enumerate values that can be passed (NSYearCalendarUnit
):
typedef CF_OPTIONS(CFOptionFlags, CFCalendarUnit) {
kCFCalendarUnitEra = (1UL << 1),
kCFCalendarUnitYear = (1UL << 2),
kCFCalendarUnitMonth = (1UL << 3),
}
You need to define your own enumeration. Then, inside your class you can test the supplied value:
CFCalendarUnit testValue = ...;
if ((testValue & kCFCalendarUnitEra) == kCFCalendarUnitEra) {
// it's an era
}
if ((testValue & kCFCalendarUnitYear) == kCFCalendarUnitYear) {
// it's a year
}