Search code examples
swiftcocoapodsswiftlint

SwiftLint Change Rules Cocoapods


I just recently installed SwiftLint using CocoaPods. I want to change the rules of my SwiftLint but when I go inside my pods -> SwiftLint, I cannot find the file named "rules" through which I can edit my rules. Please let me know how I can do the same! Thanks a lot! I really appreciate it!


Solution

  • You put rules unique to your project in a file called .swiftlint.yml (with the leading .) and commit this to source control. Re this file, see the Configuration section of the README.

    If you haven’t done this before, you’ll have to create this file. Personally, I fire up Terminal, cd into the root directory of my project, and type touch .swiftlint.yml to create a blank file. Then go to your text editor of choice and add whatever rules you want (see the README for some examples, perhaps copy-and-paste some examples into your file).

    If you go to YouTube, search for “swiftlint” and you’ll see many tutorials out there.