Just adding an answer for those who visit this page trying to do this in Swift. The approach is pretty much the same.
private class func getDaysBetweenDates(startDate:NSDate, endDate:NSDate) -> NSInteger {
var gregorian: NSCalendar = NSCalendar.currentCalendar();
let flags = NSCalendarUnit.DayCalendarUnit
let components = gregorian.components(flags, fromDate: startDate, toDate: endDate, options: nil)
return components.day
}
This answer was found here, in the discussion section of the following method:
components(_:fromDate:toDate:options:)