Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic

swift 2 0 calendar components error

swift 2 0 calendar components error  using -'ios,swift,nscalendar'

Hi I get this error in swift 2.0

Cannot invoke 'components' with an argument list of type '(NSCalendarUnit, fromDate: NSDate?, toDate: NSDate?, options: nil)'

var hoy = dataFormatter.stringFromDate(NSDate())
        var despues = dataFormatter.stringFromDate(fecha)
        var calHoy = dataFormatter.dateFromString(hoy)
        var calcDesp = dataFormatter.dateFromString(despues)
        let cal = NSCalendar.currentCalendar()
        let unit:NSCalendarUnit = .Day
        let components = cal.components(unit, fromDate: calcDesp, toDate: calHoy, options: nil)


asked Sep 21, 2015 by rolvyrf
0 votes

Related Hot Questions

Government Jobs Opening