I spent some time asking package maintainers and searching these forums, but I didn't find a satisfactory answer to my question: are there any package naming conventions/guidelines for SPM packages?
As someone who values consistency, I've been paying closer attention to how package authors name their packages in the manifest. I've looked at official packages, SSWG packages, iOS/macOS packages, etc. To clarify, I am referring to the
name property of the
Package, not products or targets.
Here's what I found:
- Some packages use dash-case (aka kebab-case). Notable examples:
swift-nio. Other that fall into this group are SSWG packages and the new standard library preview packages.
- Some packages use CamelCase. Notable examples:
SwiftSyntax. Almost all iOS/macOS packages follow this convention.
I understand if this detail is considered trivial or irrelevant, especially since package names play a much lesser role compared to other package managers such as
npm (link). It is also worth noting that this situation is not unique to SPM and can be found in other ecosystems, such as Rust, where
dash-cased crate names are both widely used (although the latter is gaining more momentum).
At the same time, I think that with the eventual introduction of a package registry (GitHub's or otherwise), these naming inconsistencies are going to surface to the end user much more than they do today.
Is the absence of SPM package naming guidelines by design? If so, can someone shed some light on this?
If it is not, would it make sense to pursue converging towards one convention? Could it happen organically or should it be enforced on the manifest level?