A .swiftpm directory is created when editing a Swift Package in Xcode. Should I ignore this directory by adding to my .gitignore?
It contains . SWIFT source code files and other project resources. Developers create SWIFTPM files using Apple Swift Playgrounds for iPad and Apple Xcode. If you have Swift Playgrounds or Xcode installed, SWIFTPM files appear as macOS packages. Otherwise, they appear as directories.
When adding a package in a project, a new swiftpm folder is created under xcshareddata , this should be committed as it contains the resolved versions of our dependencies (stored in Package. resolved file). A Package. swift file indicates that this folder is a package.
swift package resolve. | The swift package resolve command resolves the dependencies, taking into account the current version restrictions in the Package. swift manifest and Package. resolved resolved versions file, and issuing an error if the graph cannot be resolved.
The Package. resolved file is inside your . xcodeproj directory at [appName].
According to this post in the Swift forums, the .swiftpm
directory "is intended as a place for tools that operate on packages to store state or configuration files of their own that users are not expected to edit directly as source" - it is not exclusive to Xcode support. So to add it to .gitignore could potentially have a bigger impact than just ignoring Xcode files.
You could consider ignoring .swiftpm/xcode
instead, but thats also not universally recommended, because Xcode stores shared schemes there, as was mentioned in this rejected pull request.
By default, Swift Package Manager adds xcuserdata/
to the .gitignore, which is the primary ignore you need for using SPM with Xcode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With