How to calculate the age based on NSDate
Many of these answers don’t properly account for leap years and such, best is to use Apple’s methods instead of dividing by constants. Swift let birthday: NSDate = … let now = Date() let ageComponents = calendar.dateComponents([.year], from: birthday, to: now) let age = ageComponents.year Objective-C NSDate* birthday = …; NSDate* now = [NSDate date]; … Read more