PyObjC and custom blocks

The official documentation says that it is possible to use custom blocks in python code but you need to create metadata. I haven't found an example of it.

My question is how to create, use and distribute metadata for custom blocks.

Example

@interface SomeClass

- (void)doSomethingWithCompletion: (void (^)(SomeObject *obj, NSError *error))myBlock;

@end


def pythonMethod():
    def completion(obj, error):
        # staff
    foo = SomeClass.new()
    foo.doSomethingWithCompletion_(somehow_pass_completion)

The question is how somehow_pass_completion should look like and how to provide metadata for myBlock.

5
задан ipmcc 18 November 2014 в 15:09
поделиться