SwiftLint is a tool to enforce Swift style and conventions, loosely based on GitHub’s Swift Style Guide.
When you are working with a team of developers in a project, it’s become difficult to maintain codebase styling and syntax. That is why we have lint or a linter — A tool to analyze source code to make sure it matches whatever style guide you have agreed on in your team.
In the Swift world, we have SwiftLint, created by serial Swift community contributor JP Simard and others. SwiftLint hooks into Apple’s own SourceKit framework to parse your Swift code, which means it supports the full range of Swift syntax and remains up to date as Swift continues to evolve.
brew install swiftlint
Simply add the following line to your Podfile:
pod 'SwiftLint'
This will download the SwiftLint binaries and dependencies in Pods/
during your next pod install
execution and will allow you to invoke it via ${PODS_ROOT}/SwiftLint/swiftlint
in your Script Build Phases.
$ mint install realm/SwiftLint
You can also install SwiftLint by downloading SwiftLint.pkg
from the latest GitHub release and running it. During the installation, you may see this alert
SwiftLint.pkg Installation Alert
In that case, you need to grant permission to run SwiftLint.pkg
on your system. To do that, navigate to Menu > System Preferences... > Security & Privacy > General
and click Open Anyway
button
#github #ios #swift #swiftlint #style-guides