Rails-like dates in Objective-C
SexyDates is an open source Objective-C category on NSNumber that allows you to create dates (NSDate objects) in a sexy, Rails-/ActiveSupport-like way.
Examples
#import "NSNumber+SexyDates.h"
@(1).minute.fromNow // In a minute
@(3).days.ago // Three days ago
[@(4).weeks since:@(1).day.fromNow] // Tomorrow in 4 weeks
[@(2).years until:@(1).day.ago] // Yesterday two years ago
Have fun!
Written by Dominique d'Argent
Related protips
2 Responses
SexyDates indeed!
over 1 year ago
·
@alexcristea haha, glad you like it (at least the name) ;-).
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Objective-c
Authors
Related Tags
#objective-c
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#