How can i calculate the number of days in a year for any calendar, not just gregorian. I have tried this
NSUInteger *days = [[NSCalendar currentCalendar] range
Swift 3 extension:
extension Date { public func isLeapYear() -> Bool { let components = Calendar.current.dateComponents([.year], from: self) guard let year = components.year else { return false } return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0) } }