Skip to content

AppleArealidea/SwiftLintPlugin

 
 

Repository files navigation

GitHub Twitter: @lukeeep_

SwiftLintPlugin

A Swift Package Plugin for SwiftLint that will run SwiftLint on build time and show errors & warnings in Xcode.

⚠️ There now is an official version in the SwiftLint repo!

Add to Package

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")
        ]
    ),
]

Add to Project

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:

Screen Shot 2022-09-02 at 09 33 23

You may need to enable & trust the plugin before you can actually run it during builds.

Fix Warnings

As of version 0.1.0 this package also includes a command plugin which can be called on any target.

  1. Select a project or package in the project navigator.
  2. Richt-click and select SwiftLintFix.
    • alternatively you can select File > Packages > SwiftLintFix.
  3. Choose the target(s) to run the swiftlint --fix command on.

Screenshot 2022-10-31 at 12 59 53


Buy Me A Coffee

About

A Swift Package Plugin for SwiftLint

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 100.0%