Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
# iOS Objective-C Style Guide
# Based on Apple's coding conventions and common iOS practices

BasedOnStyle: LLVM

# Language specific settings
Language: ObjC

# Indentation
IndentWidth: 4
TabWidth: 4
UseTab: Never
ContinuationIndentWidth: 4

# Line length
ColumnLimit: 100

# Pointer and reference alignment
PointerAlignment: Right
ReferenceAlignment: Right

# Braces
BreakBeforeBraces: Attach
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: false

# Method and function formatting
AlignAfterOpenBracket: Align
AllowAllParametersOfDeclarationOnNextLine: false
BinPackParameters: false
BinPackArguments: false

# Objective-C specific
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true

# Spacing
SpaceBeforeParens: ControlStatements
SpaceBeforeAssignmentOperators: true
SpaceAfterCStyleCast: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false

# Keep things together
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1

# Align consecutive assignments and declarations
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false

# Comments
ReflowComments: true
SpacesBeforeTrailingComments: 2

# Line breaks
AllowShortCaseLabelsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true

# Import/Include sorting
SortIncludes: CaseInsensitive
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"'
Priority: 1
- Regex: '^<.*\.h>'
Priority: 2
- Regex: '^<.*>'
Priority: 3

# Penalty weights (fine-tuning line breaks)
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
4 changes: 2 additions & 2 deletions TOSegmentedControl/Private/TOSegmentedControlSegment.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN

/// Create an array of objects given an array of strings and images
+ (NSArray *)segmentsWithObjects:(NSArray *)objects
forSegmentedControl:(TOSegmentedControl *)segmentedControl;;
forSegmentedControl:(TOSegmentedControl *)segmentedControl;

/// Create a non-reversible item from this class
- (nullable instancetype)initWithObject:(id)object
Expand All @@ -88,7 +88,7 @@ NS_ASSUME_NONNULL_BEGIN
forSegmentedControl:(TOSegmentedControl *)segmentedControl;
- (instancetype)initWithImage:(UIImage *)image
reversible:(BOOL)reversible
forSegmentedControl:(TOSegmentedControl *)segmentedControl ;
forSegmentedControl:(TOSegmentedControl *)segmentedControl;

/// If the item is reversible, flip the direction
- (void)toggleDirection;
Expand Down
Loading
Loading