<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hello.</div><div class=""><br class=""></div><div class="">I’ve recently forked swift-corelibs-foundation and implemented Comparable for&nbsp;NSOperatingSystemVersion.</div><div class=""><br class=""></div><div class="">What’s the point of this? Well, in the words of a friend, "It’s a value type with a clear ordering, why not?”.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I have also added a new initializer that allows something like</div><div class=""><br class=""></div><div class=""><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: pre-wrap; background-color: rgb(234, 255, 234);" class="">NSOperatingSystemVersion(10,11,4)</span></div><div class=""><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: pre-wrap; background-color: rgb(234, 255, 234);" class=""><br class=""></span></div><div class="">instead of requiring</div><div class=""><br class=""></div><div class=""><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: pre-wrap; background-color: rgb(234, 255, 234);" class="">NSOperatingSystemVersion(</span><span style="color: rgb(51, 51, 51); font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; white-space: pre-wrap; background-color: rgb(234, 255, 234);" class="">majorVersion: 10, minorVersion: 11, patchVersion: 4)</span></div><div class=""><br class=""></div><div class="">Not only is this new initializer <i class="">easier</i>&nbsp;<i class="">to type</i>, but it also much clearer, especially when one is quickly scanning through code.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">My changes:&nbsp;<a href="https://github.com/rsmoz/swift-corelibs-foundation/commit/e3db7ae2d7f4ba27ae5597e157b41a4b34def468" class="">https://github.com/rsmoz/swift-corelibs-foundation/commit/e3db7ae2d7f4ba27ae5597e157b41a4b34def468</a></div><div class=""><br class=""></div><div class="">Also, the Version struct in&nbsp;swift-package-manager has an extension for Comparable, as well as concise initializer:</div><div class=""><a href="https://github.com/apple/swift-package-manager/blob/39fdccc74fcb11bc0a352b73fb7e656ba6843ff4/Sources/PackageDescription/Version.swift#L23" class="">https://github.com/apple/swift-package-manager/blob/39fdccc74fcb11bc0a352b73fb7e656ba6843ff4/Sources/PackageDescription/Version.swift#L23</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Tests:&nbsp;<a href="https://github.com/rsmoz/swift-corelibs-foundation/commit/db44f29e42f29ad0fe35f69ac83d853453c77bc6" class="">https://github.com/rsmoz/swift-corelibs-foundation/commit/db44f29e42f29ad0fe35f69ac83d853453c77bc6</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I’d like to hear your opinions on my changes. For instance, do you think implementing Comparable for&nbsp;NSOperatingSystemVersion would best be done in an extension? That’s how SwiftPM does it.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Best,</div><div class="">Robert Mozayeni</div></body></html>