I'm trying to convert the Objective-C code in this answer, with the correction found in this answer, to Swift:
var theTimeInterval = NSTimeInterval()
var calendar = NSCalendar(calendarIdentifier: NSGregorianCalendar)
var date1 = NSDate()
var date2 = NSDate(timeInterval: theTimeInterval, sinceDate: date1)
var unitFlags = NSCalendarUnit(UInt.max)
var info = calendar.components(unitFlags, fromDate:date1, toDate:date2, options:0)
However, on the finial line, Xcode is giving me an inexplicable error:
Extra argument 'toDate' in call
I looked at the code for NSCalendar
by command-clicking it and the function signature I'm using seems to exactly match its components
method. So what am I doing wrong?