Wednesday, 13 February 2019

Swiftlint in Demo and yml File Template

Check if it is ready to use Homebrew via command: brew doctor

Install Swiftlint using Homebrew

1. Install xcode command-line tool
xcode-select --install

2. Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3. brew install Swiftlint



Use Swiftlint in your XCode project

1. Create a .swiftlint.yml file in the root path of your project
2. Add run script in Build Phases



Configure rules in .swiftlint.yml
1. open .swiftlint.yml
2. copy the example below and build



Disable rules in code if needed:
// swiftlint:disable:next function_body_length
Check how to disable: 
https://github.com/realm/SwiftLint/#disable-rules-in-code

Check the full list of Swiftlint rules:

https://github.com/realm/SwiftLint/blob/master/Rules.md






No comments:

Post a Comment