Improving Swift Code Readability With SwiftLint | by Anurag Ajwani | Mar, 2022

brew set up swiftlint
SwiftLint set up in terminal
swiftlint
disabled_rules:
- void_return
- trailing_whitespace
- line_length
// Specific return
var id: String return UUID().uuidString
// Implicit return
var id: String UUID().uuidString
opt_in_rules:
- implicit_return
only_rules:
- implicit_return
swiftlint guidelines
swiftlint guidelines command

3. Operating SwiftLint through the Xcode construct course of

export PATH="$PATH:/choose/homebrew/bin"

if which swiftlint >/dev/null; then
swiftlint
else
echo "warning: SwiftLint not put in, obtain from https://github.com/realm/SwiftLint"
fi

4. Disabling guidelines on a items of code and entire recordsdata

// swiftlint:disable implicit_return
// swiftlint:allow implicit_return
SwiftLint now not warning about implicit return
excluded:
- SaladMaker/SaladPreppingView.swift

More Posts