Hello Swift Developers,

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 { }

In my opinion, the code is still readable if developers use comparison
operators on NSDates.

Here's a quick implementation from my swift-corelibs-foundation fork:
https://github.com/chrisamanse/swift-corelibs-foundation/commit/3c4eff643c5271de5bec2461798051347be13916

Thank you.
_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

Reply via email to