Skip to content

Instantly share code, notes, and snippets.

@oleavr
Created June 3, 2015 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oleavr/47d02312ea5676677a53 to your computer and use it in GitHub Desktop.
Save oleavr/47d02312ea5676677a53 to your computer and use it in GitHub Desktop.
ObjC class creation API draft 1
const NSAutoreleasePool = ObjC.classes.NSAutoreleasePool;
const pool = NSAutoreleasePool.alloc().init();
const MyConnectionDelegateProxy = ObjC.registerClass({
name: 'MyConnectionDelegateProxy',
protocols: [ObjC.protocols.NSURLConnectionDelegate, ObjC.protocols.NSURLConnectionDataDelegate],
methods: {
'- connection:didReceiveResponse:': {
retType: 'void',
argTypes: ['object', 'object'],
implementation: function (connection, response) {
console.log('- connection:didReceiveResponse');
console.log('connection=' + connection);
console.log('response=' + response);
}
}
}
});
const proxy = MyConnectionDelegateProxy.alloc().init();
pool.release();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment