SwiftLint is an open-source tool used to enforce styles and conventions.

Installing it is not difficult, but someone might need a few hints, so I have prepared this blog post to explain them.

First of all, you need to download it from GitHub, download the latest SwiftLink.pkg from the GitHub release page.

You won't be able to open it, because you will get this popup message:
SwiftLintWarning

After the message, you need to go to System Preferences >>> Security & Privacy, and click "Open Anyway":
SwiftLintSecurityPrivacy

Finally, add SwiftLint to your project in a new Run Script Phase:
SwiftLintRunScriptPhase

  1. select your project;
  2. select your target;
  3. select the Build Phases tab;
  4. click on the + icon;
  5. select New Run Script Phase;
  6. copy and paste the below script:
    if which swiftlint >/dev/null; then
      swiftlint
    else
      echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
    fi
    

You can find more advance info in this blog post: How to use SwiftLint with Xcode to enforce Swift style and conventions?