getPublicDeclaration method

OCClassDeclaration getPublicDeclaration()

生成 UniCallback 在头文件中的类声明

Implementation

OCClassDeclaration getPublicDeclaration() {
  return OCClassDeclaration(
      depth: depth,
      className: getName(methodName, paramName),
      parentClass: 'NSObject',
      isInterface: true,
      properties: [
        Variable(AstString(), Keys.callbackName),
        Variable(
            AstCustomType('id', generics: [
              AstCustomType('$objcUniAPIPrefix$typeUniCallbackDispose')
            ]),
            Keys.delegate)
      ],
      instanceMethods: [
        Method(
            name: 'onEvent',
            parameters: paramGeneric.realType() is AstVoid
                ? const []
                : [Variable(paramGeneric, 'callback')])
      ]);
}