|
| 1 | +--- |
| 2 | +# iOS Objective-C Style Guide |
| 3 | +# Based on Apple's coding conventions and common iOS practices |
| 4 | + |
| 5 | +BasedOnStyle: LLVM |
| 6 | + |
| 7 | +# Language specific settings |
| 8 | +Language: ObjC |
| 9 | + |
| 10 | +# Indentation |
| 11 | +IndentWidth: 4 |
| 12 | +TabWidth: 4 |
| 13 | +UseTab: Never |
| 14 | +ContinuationIndentWidth: 4 |
| 15 | + |
| 16 | +# Line length |
| 17 | +ColumnLimit: 0 |
| 18 | + |
| 19 | +# Pointer and reference alignment |
| 20 | +PointerAlignment: Right |
| 21 | +ReferenceAlignment: Right |
| 22 | + |
| 23 | +# Braces |
| 24 | +BreakBeforeBraces: Attach |
| 25 | +AllowShortBlocksOnASingleLine: Empty |
| 26 | +AllowShortFunctionsOnASingleLine: Empty |
| 27 | +AllowShortIfStatementsOnASingleLine: WithoutElse |
| 28 | +AllowShortLoopsOnASingleLine: false |
| 29 | + |
| 30 | +# Method and function formatting |
| 31 | +AlignAfterOpenBracket: Align |
| 32 | +AllowAllParametersOfDeclarationOnNextLine: false |
| 33 | +BinPackParameters: false |
| 34 | +BinPackArguments: false |
| 35 | + |
| 36 | +# Objective-C specific |
| 37 | +ObjCBinPackProtocolList: Never |
| 38 | +ObjCBlockIndentWidth: 4 |
| 39 | +ObjCBreakBeforeNestedBlockParam: true |
| 40 | +ObjCSpaceAfterProperty: true |
| 41 | +ObjCSpaceBeforeProtocolList: true |
| 42 | + |
| 43 | +# Spacing |
| 44 | +SpaceBeforeParens: ControlStatements |
| 45 | +SpaceBeforeAssignmentOperators: true |
| 46 | +SpaceAfterCStyleCast: false |
| 47 | +SpacesInContainerLiterals: false |
| 48 | +SpacesInParentheses: false |
| 49 | +SpacesInSquareBrackets: false |
| 50 | + |
| 51 | +# Keep things together |
| 52 | +KeepEmptyLinesAtTheStartOfBlocks: false |
| 53 | +MaxEmptyLinesToKeep: 1 |
| 54 | + |
| 55 | +# Align consecutive assignments and declarations |
| 56 | +AlignConsecutiveAssignments: false |
| 57 | +AlignConsecutiveDeclarations: false |
| 58 | + |
| 59 | +# Comments |
| 60 | +ReflowComments: true |
| 61 | +SpacesBeforeTrailingComments: 2 |
| 62 | + |
| 63 | +# Line breaks |
| 64 | +AllowShortCaseLabelsOnASingleLine: false |
| 65 | +AlwaysBreakAfterReturnType: None |
| 66 | +AlwaysBreakBeforeMultilineStrings: false |
| 67 | +BreakBeforeBinaryOperators: None |
| 68 | +BreakBeforeTernaryOperators: true |
| 69 | + |
| 70 | +# Import/Include sorting |
| 71 | +SortIncludes: CaseInsensitive |
| 72 | +IncludeBlocks: Regroup |
| 73 | +IncludeCategories: |
| 74 | + - Regex: '^<.*\.h>' |
| 75 | + Priority: 1 |
| 76 | + - Regex: '^<.*>' |
| 77 | + Priority: 2 |
| 78 | + - Regex: '^"' |
| 79 | + Priority: 3 |
| 80 | + |
| 81 | +# Penalty weights (fine-tuning line breaks) |
| 82 | +PenaltyBreakBeforeFirstCallParameter: 19 |
| 83 | +PenaltyBreakComment: 300 |
| 84 | +PenaltyBreakFirstLessLess: 120 |
| 85 | +PenaltyBreakString: 1000 |
| 86 | +PenaltyExcessCharacter: 1000000 |
| 87 | +PenaltyReturnTypeOnItsOwnLine: 200 |
0 commit comments