[PyObjC] Method Signature

To call PyObjC class/instance method from pure Objective-C object, method signature is required. Actually, the methods are called even without the signatures, but arguments (incl. ’self’) are not set correctly. ex.

# - (void)startExport;
@objc.signature('v@:')
def startExport(self):
  pass

ex.

# - (BOOL)updateCurrentFrame:(NSTimeInterval)time
#              withDuration:(float)duraiotn;
@objc.signature('c@:df')
def updateCurrentFrame_withDuration_(self, time, duration):
   pass

ex.

# - (void)endExport:(BOOL)result;
@objc.signature('v@:c')
def endExport_(self, result):
  pass

Type encodings for method signatures: The Objective-C 2.0 Programming Language: Type Encodings


PyObjCのメソッドを純粋なObjective-Cから呼び出すためにはメソッド・シグネチャーを宣言しとかないといけません(呼び出されるのですが、selfを含む引数がちゃんと設定されません)。これに気づくまでに1時間以上無駄にしました。

Body
Comment me!