Swift: Binary operator '|' cannot be applied to two NSCalendarUnit operands (Xcode 7)

168 Views Asked by At

Why I can't use | Binary operator in calendar.components to separate the units? According to this article by NSHipster or this Github project by minorbug I should be allowed to do it.

Code:

calendar.components(NSCalendarUnit.Month | NSCalendarUnit.Day, fromDate: date)

Answers I find in Apple Community: But Xcode 7 don't allow me to use NSDateComponentsFormatter() for componentsUnits.

Concerns: This might be Xcode 7 cause someone says this is fine in Xcode 6, does anyone have a solution to this?

0

There are 0 best solutions below