A Swift Package Plugin for SwiftLint that will run SwiftLint on build time and show errors & warnings in Xcode.
Once SwiftLint offers their own implementation, this will be obsolete.
Implementation proposed here by @marcoboerner.
First add a dependency from this package:
dependencies: [
// ...
.package(url: "https://github.com/lukepistrol/SwiftLintPlugin", from: "0.0.4"),
]
Then add it to your targets as a plugin:
targets: [
.target(
name: "YOUR_TARGET",
dependencies: [],
plugins: [
.plugin(name: "SwiftLint", package: "SwiftLintPlugin")
]
),
]
Starting with Xcode 14, plugins can also work on Xcode Project's targets. To do so, simply add this package to your SPM dependencies in Xcode. After that open your target's settings > Build Phases
and add SwiftLint
to Run Build Tool Plug-ins
like shown below:
You may need to enable & trust the plugin before you can actually run it during builds.