自动将Objective-C代码转成JSPatch脚本的工具:JSPatch Convertor
JSPatch Convertor是一个工具能够将Objective-C代码自动成JSPatch脚本。
Usage
Check out http://bang590.github.io/JSPatchConvertor
Please use Chrome or Safari.
Supported
The Objective-C syntax below is supported to convert:
Method declaration
- (void)requestUrl:(NSString *)url param:(NSDictionary *)dict {}
requestUrl_param: function(url, dict) {}
Method calling
[[JPRequest alloc] initWithUrl:url param:dict];
JPRequest.alloc().initWithUrl_param(url, dict);
Block syntax
[JPRquest handleCallback:^(id data, NSError *err) {}];
JPRquest.handleCallback(block('id,NSError*', function(data, err) {}));
Variable declaration
NSString *str = @"content";
var str = "content";
Getting/Setting Property
self.handler.successBlock(data); self.handler.data = [[JPData alloc] init];
self.handler().successBlock()(data); self.handler().setData(JPData.alloc().init());
NSString / NSArray / nil ...
NSDictionary *dict = nil; dict = @{ @"arr": @[@(1), @"2"] };
var dict = null; dict = { "arr": [(1), "2"] };
Unsupported
JSPatch Convertor didn't support the Objective-C / C syntax below, you should modify it manually after converted:
- Macro / constant variable / Enum
- C function calling
- GCD functions
- Pointer / Struct
- Getting / Setting private variable
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!