Swift 2.0 calendar components error

As of Swift 2, NS_OPTIONS (such as NSCalendarOptions) are mapped to Swift as a OptionSetType
which offers a set-like interface. In particular, “no options”
can now be specified as [] instead of nil:

let components = cal.components(unit, fromDate: calcDesp!, toDate: calHoy!,
                               options: []) 

See also Swift 2.0 – Binary Operator “|” cannot be applied to two UIUserNotificationType operands
and the recently added answers to How to create NS_OPTIONS-style bitmask enumerations in Swift? for more information.

Leave a Comment