# SwiftFormat Config # Version: 0.49.14 # Rules: https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md # NOTE: Caveat with using both SwiftFormat and SwiftLint: # It's possible that enabling or changing a rule could cause a warning in SwiftLint if rules are not aligned # For this reason, after making a change to this file, run the following to ensure that swiftlint doesn't show any additional warnings # "swiftformat . && swiftlint --quiet" # TESTING A CHANGE: How to automatically run swiftformat to "Live Test" a change to this config # 1. Install entr to watch changes to this file: brew install entr # 2. Run: ls .swiftformat | entr -c sh -c "git add .swiftformat && git checkout . && swiftformat . && git -P diff && swiftlint --quiet" # Excluded files and dirs --exclude samples,testing,ads --exclude Package.swift # Enabled rules --rules andOperator --rules anyObjectProtocol --rules assertionFailures --rules blankLinesAroundMark --rules blankLinesAtEndOfScope --rules blankLinesBetweenScopes --rules braces --rules consecutiveBlankLines --rules consecutiveSpaces --rules duplicateImports --rules elseOnSameLine --rules emptyBraces --rules enumNamespaces --rules extensionAccessControl --rules fileHeader --rules hoistPatternLet --rules indent --rules initCoderUnavailable --rules isEmpty # (opt-in) --rules leadingDelimiters --rules linebreakAtEndOfFile --rules linebreaks --rules modifierOrder --rules preferKeyPath --rules redundantBackticks --rules redundantBreak --rules redundantClosure --rules redundantExtensionACL --rules redundantGet --rules redundantInit --rules redundantLet --rules redundantLetError --rules redundantNilInit --rules redundantObjc --rules redundantParens --rules redundantPattern --rules redundantRawValues --rules redundantReturn --rules redundantSelf --rules redundantType --rules redundantVoidReturnType --rules semicolons --rules sortedImports --rules spaceAroundBraces --rules spaceAroundBrackets --rules spaceAroundComments --rules spaceAroundGenerics --rules spaceAroundOperators --rules spaceAroundParens --rules spaceInsideBraces --rules spaceInsideBrackets --rules spaceInsideComments --rules spaceInsideGenerics --rules spaceInsideParens --rules strongifiedSelf --rules strongOutlets --rules todos --rules trailingClosures --rules trailingCommas --rules trailingSpace --rules typeSugar --rules void --rules wrap --rules wrapArguments --rules wrapAttributes --rules wrapEnumCases # (opt-in) --rules yodaConditions # Disabled Rules # --rules acronyms # (opt-in) # capitalizes acronyms, ex varWithUrl -> varWithURL, methodWithId() -> methodWithID() # --rules blankLinesAtStartOfScope # removes the first blank line in classes, structs, funcs etc # --rules blankLinesBetweenImports # (opt-in) # removes blank line between imports # --rules blockComments # (opt-in) # changes all block comments i.e. /* ... */ to // style comments # --rules markTypes # (opt-in) # adds various "// MARK: -" sections at the top of classes, extensions # --rules numberFormatting # makes numbers like 123_456_789 # --rules organizeDeclarations # (opt-in) # adds Internal, Private, Lifecycle sections and re-orders a lot of code # --rules preferDouble # (opt-in) # Replaces occurrences of CGFloat with Double # --rules sortedSwitchCases # (opt-in) # sorts cases in enums # --rules unusedArguments # changes unused args to an underscore, too many changes # --rules wrapConditionalBodies # (opt-in) # moves the return in a guard on a new line # --rules wrapMultilineStatementBraces # puts brace after multiline statement on new line, swiftlint conflict # --rules wrapSwitchCases # (opt-in) # splits "case .one, .two:" onto 2 lines # Options --extensionacl on-declarations --header "/*\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed under the license found in the\n * LICENSE file in the root directory of this source tree.\n */" --ifdef no-indent --importgrouping "testable-first" --indent 2 --indentstrings true --modifierorder open, override --redundanttype "inferred" --swiftversion 5 --wraparguments before-first --xcodeindentation enabled