FormatCodes
首页/Objective-C 工具/Objective-C 格式化

Objective-C 格式化工具

在线格式化 Objective-C 和 Objective-C++ 代码,基于 clang-format 的 WebAssembly 版本,支持 Google、LLVM、WebKit 等风格预设,直接在浏览器中完成处理。

浏览器本地处理
无需登录
基于 clang-format
语言
Objective-Cmain.m
方言
风格
缩进
行宽
输入可编辑
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
输出Objective-C 有效38 行 · 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 空格 · Google · clang-format本地处理 · 就绪
工具说明Objective-C
简介
使用 clang-format 的 WebAssembly 版本在浏览器中格式化 Objective-C(.m)和 Objective-C++(.mm)代码。支持 Google、LLVM、WebKit、Mozilla、GNU 五种风格预设,可自定义缩进宽度和行宽。适用于 iOS/macOS 历史遗留项目的代码整理,所有处理在浏览器本地完成,内容不会离开你的设备。
场景
格式化 iOS / macOS 历史遗留 Objective-C 代码统一团队 ObjC 代码风格整理 .m 和 .mm 混合 C++ 文件对接 CI/CD 代码风格检查
使用步骤
123
粘贴或上传选择选项获取结果

相关工具

相关指南

常见问题

搜索工具

搜索 55+ 个格式化、转换、压缩、对比与生成工具