const fs = require("fs");
const objectiveCParser = require("objective-c-parser");
const content = fs.readFileSync("/path/to/objective-c/Ponies.h");
const output = objectiveCParser(content);
fs.writeFileSync("/path/to/project/ponies.json", output);
#import <Foundation/Foundation.h>
@protocol Ponies, Foo;
@interface BasicName : NSObject
@property(nonatomic, readonly) uninteresting<IgnorePlease> matcher;
- (NSInteger)basicMethodOne;
- (NSString) basicMethodTwoWithArgOne:(NSInteger)argOne AndArgTwo:(NSString)argTwo;
@end
{
"name": "BasicName",
"methods": [
{
"args": [],
"comment": "This is the comment of basic method one",
"name": "basicMethodOne",
"returnType": "NSInteger"
},
{
"args": [
{
"type": "NSInteger",
"name": "argOne"
},
{
"type": "NSString",
"name": "argTwo"
}
],
"comment":
"This is the comment of basic method two.\nIt has multiple lines",
"name": "basicMethodTwoWithArgOneAndArgTwo",
"returnType": "NSString"
}
]
}