[swift-corelibs-dev] [swift-evolution] Proposal: Conforming NSDate to Comparable

Brent Royal-Gordon brent at architechies.com
Sat Dec 5 17:51:48 CST 2015

> I think it's a good idea to conform NSDate to the Comparable protocol, so instead of using:
> if someDate.compare(today) == .OrderedAscending { }
> Developers can easily compare using compare dates using comparison operators:
> if someDate < today { }

I would also suggest we add Strideable, which would allow you to add and subtract NSTimeIntervals, plus subtract two NSDates to get the NSTimeInterval between them.


Brent Royal-Gordon

More information about the swift-corelibs-dev mailing list