FormatCodes
Home/Objective-C Tools/Objective-C Formatter

Objective-C Formatter

Format Objective-C and Objective-C++ code online for free with clang-format, right in your browser.

Local browser processing
No sign-up required
Powered by clang-format
Language
Objective-Cmain.m
Dialect
Style
Indent
Line width
InputEditable
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
OutputObjective-C valid38 lines · 969 B
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#import <Foundation/Foundation.h>
@interface Person : NSObject
@property (nonatomic, strong) NSString *name;
@property (nonatomic, assign) NSInteger age;
- (instancetype)initWithName:(NSString *)name age:(NSInteger)age;
- (NSString *)description;
@end
@implementation Person
- (instancetype)initWithName:(NSString *)name age:(NSInteger)age {
self = [super init];
if (self) {
_name = name;
_age = age;
}
return self;
}
- (NSString *)description {
return [NSString stringWithFormat:@"%@ (%ld)", _name, (long)_age];
}
@end
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSArray<Person *> *people = @[
[[Person alloc] initWithName:@"Alice" age:30],
[[Person alloc] initWithName:@"Bob" age:25],
[[Person alloc] initWithName:@"Carol" age:35],
];
NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"age" ascending:YES];
NSArray *sorted = [people sortedArrayUsingDescriptors:@[sort]];
for (Person *p in sorted) {
NSLog(@"%@", p);
}
}
return 0;
}
UTF-8 · 4 spaces · Google · clang-formatLocal processing · Ready
How It WorksObjective-C
Overview
Format Objective-C (.m) and Objective-C++ (.mm) code in your browser using a WebAssembly build of clang-format. It supports five style presets — Google, LLVM, WebKit, Mozilla, and GNU — plus custom indent width and line width. Well suited for cleaning up legacy iOS/macOS projects. Everything runs locally in your browser; your content never leaves your device.
Use Cases
Format legacy Objective-C code from iOS / macOS projectsUnify a team's Objective-C code styleClean up mixed .m and .mm C++ filesWire up code style checks for CI/CD
Steps
123
Paste or uploadChoose optionsGet the result

Related Tools

Related Guides

Frequently Asked Questions

Search Tools

Search 55+ formatting, conversion, minification, diffing, and generation tools