For example in EventKit there is a property on EKCalendar
called supportedEventAvailabilities
which is of type EKCalendarEventAvailabilityMask
. It is a mask of all the supported event availabilities. I know you could theoretically set them like this (if this property was writable):
calendar.supportedEventAvailabilities = [.Busy, .Free]
But how do you read those values again? I ended up with code like this:
let availabilities = calendar.supportedEventAvailabilities
if (availabilities.rawValue & EKCalendarEventAvailabilityMask.Busy.rawValue) == EKCalendarEventAvailabilityMask.Busy.rawValue {
// 'Busy' is in there!
}
if (availabilities.rawValue & EKCalendarEventAvailabilityMask.Free.rawValue) == EKCalendarEventAvailabilityMask.Free.rawValue {
// 'Free' is in there!
}
But this does not feel right. Does anyone know how to do this properly?