0

The following code in Xcode 7 Swift gives the following compiler error, can anyone help?

   let unitFlags: NSCalendarUnit = .CalendarUnitYear | .CalendarUnitMonth | .CalendarUnitDay | .CalendarUnitWeekday

error: type of expression is ambiguous without more context

tech74
  • 1,609
  • 1
  • 20
  • 39

1 Answers1

6

In Swift 2 the OptionSetType syntax and the NSCalendarUnit enumeration items have been changed

let unitFlags: NSCalendarUnit = [.Year, .Month, .Day, .Weekday]
vadian
  • 274,689
  • 30
  • 353
  • 361