JSPatch Convertor is a tool that converts Objective-C code to JSPatch script automatically.
( What's JSPatch? )
Check out http://bang590.github.io/JSPatchConvertor
Please use Chrome or Safari.
Click: https://github.com/DevSonw/JSPatchConvertor/blob/gh-pages/JSPatchConvertor.zip
The Objective-C syntax below is supported to convert:
- (void)requestUrl:(NSString *)url param:(NSDictionary *)dict {}
requestUrl_param: function(url, dict) {}
[[JPRequest alloc] initWithUrl:url param:dict];
JPRequest.alloc().initWithUrl_param(url, dict);
[JPRquest handleCallback:^(id data, NSError *err) {}];
JPRquest.handleCallback(block('id,NSError*', function(data, err) {}));
NSString *str = @"content";
var str = "content";
self.handler.successBlock(data);
self.handler.data = [[JPData alloc] init];
self.handler().successBlock()(data);
self.handler().setData(JPData.alloc().init());
NSDictionary *dict = nil;
dict = @{
@"arr": @[@(1), @"2"]
};
var dict = null;
dict = {
"arr": [(1), "2"]
};
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