I have finally gotten far enough down my to‐do list to investigate using
SwiftFormat. The read‐me says:
users can depend on
swift-formatas a Swift Package Manager dependency and import the
SwiftFormatmodule, which contains the entry points into the formatter's diagnostic and correction behavior.
SwiftFormat product only includes the
SwiftFormat module. It does not seem possible to do much of anything without also cheating and importing internal‐only modules like
SwiftFormatConfiguration. For example, the only visible initializer for the
SwiftLinter type requires a
Configuration instance, but that type is neither provided nor exported by the only module marked for consumption. Is that an oversight?
Right now the package manager does not block internal modules from being imported by clients, so it can be worked around, but if one day it does there will be trouble. On the other hand, when the import model is finally sorted out (
@_implementationOnly, etc.) it will probably be impossible to end up in this situation in the first place.
So the questions are:
- Which modules are intended for client use, despite what the manifest says?
- Can those modules be added to the library product declaration?