I don't know what is wrong with the below code. I think it should work. The error I got is EXC_BAD_ACCESS
// Playground - noun: a place where people can play
import UIKit
extension NSCalendar {
func nextDay(date:NSDate) -> NSDate {
var dateComponents = self.components(.YearCalendarUnit | .MonthCalendarUnit | .DayCalendarUnit, fromDate: date)
dateComponents.day += 1
let nextDate = self.dateFromComponents(dateComponents)!
return nextDate
}
func getNextDay(date:NSDate) -> NSDate {
var method = nextDay
let tomorrow = method(date)
return tomorrow
}
}
![enter image description here][2]let calendar = NSCalendar.currentCalendar()
let today = NSDate()
let tomorrow = calendar.getNextDay(today)