I’m struggling to find a way to apply SwiftLint to my swift packages.
But after searching a lot, I couldn’t find any way.
I use micro application architecture, which leads me to many micro packages. I am looking for a way to use SwiftLint
for my swift packages.
3
Answers
I have the same problem. The current version of SPM does not support Run Scripts so you can’t run
SwiftLint
in a way like on the main project. But future versions of SPM will support it.Currently, I use the command line to find all the issues. This is not very convenient but something.
In the package folder:
e.g.
When I’m working on a SPM package I usually create an Xcode project that locally imports the package and use that project to work on the project.
This allows me to run stuff like
SwiftLint
. It’s also handy to remember to use the correct access control modifiers.You can see an example in this project of mine.
Ok, SwiftLint just updated main repository, commit 3fd1573 added support through SwiftPM &
Run Build Tool Plug-ins
. Take in account that you need Xcode 14 or later to use this approach.