[swift-evolution] Thoughts on making NSOperatingSystemVersion Comparable?
Robert S Mozayeni
dev at mzy.me
Tue Jan 26 05:32:54 CST 2016
I’ve recently forked swift-corelibs-foundation and implemented Comparable for NSOperatingSystemVersion.
What’s the point of this? Well, in the words of a friend, "It’s a value type with a clear ordering, why not?”.
I have also added a new initializer that allows something like
instead of requiring
NSOperatingSystemVersion(majorVersion: 10, minorVersion: 11, patchVersion: 4)
Not only is this new initializer easier to type, but it also much clearer, especially when one is quickly scanning through code.
My changes: https://github.com/rsmoz/swift-corelibs-foundation/commit/e3db7ae2d7f4ba27ae5597e157b41a4b34def468
Also, the Version struct in swift-package-manager has an extension for Comparable, as well as concise initializer:
I’d like to hear your opinions on my changes. For instance, do you think implementing Comparable for NSOperatingSystemVersion would best be done in an extension? That’s how SwiftPM does it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution