Great work, this looks awesome @davedelong. Just a few comments
- this hogs the
Time
module name, ie. it'll clash with anything that has a module calledTime
, exported, not exported, private, public, .... Similarly, it takes thetime
URL component and theTime
package name, all of those have to be unique in a whole package graph as of today . This package will probably be in conflict with many other packages revealed in this github search. For the SSWG we therefore require some uniqueness, see for example here. -
Time
exports public types likeValue
, I'd probably recommend prefixing at leastValue
because it's such a generic name - For your own benefit, I would recommend not making your
Error
typespublic enum
s. The language dialect that is used in Swift packages means that all enums are exhaustive so won't be able to add an enum case without making a new major SemVer version . We messed that up in SwiftNIO and are suffering quite frequently, we intend to fix this for NIO 3 which is a long time out though. I'd recommend usingpublic struct SomethingError
like in this example assuming you don't need associated values. If you do need associated values, then your best shot is probably creatingpublic enum TimeErrors {}
and nesting all errors as types in there? - regarding public API of a package that I'd expect to be widely used, you might want to check the SwiftNIO docs regarding public API, maybe you get some inspiration.