Weird error converting date code

This line of code I could not get to compile in S2 (yes it worked in 1.2):


let newerDate = calendar.dateByAddingUnit(NSCalendarUnit.Day, value: 1, toDate: NSDate(), options: nil)


The error message:


Cannot invoke 'dateByAddingUnit' with an argument list of type '(NSCalendarUnit, value: Int, toDate: NSDate, options: nil)'


Must be a bug.

Ever figure this out?

I'm also getting this

In Swift 2, NS_OPTIONS are imported as OptionSetType, and its empty value is represented by [], not nil.

let newerDate = calendar.dateByAddingUnit(NSCalendarUnit.Day, value: 1, toDate: NSDate(), options: [])

See the Swift section of the release notes of Xcode 7 beta.

Weird error converting date code
 
 
Q