[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.
https://gist.github.com/brentdax/11b3275424d0833cfd99
--
Brent Royal-Gordon
Architechies
More information about the swift-evolution
mailing list