Commit 26255ef3 authored by DanmeiChen's avatar DanmeiChen

fix wrapper delegate

parent 1e09e1ca
......@@ -162,6 +162,10 @@ class SwiftTranslator(object):
listenerDict['delegate']['cb_name'] = method.name.to_snake_case()
listenerDict['delegate']['interfaceClassName'] = listenedClass.name.translate(self.nameTranslator)
listenerDict['delegate']['type'] = method.returnType.translate(self.langTranslator, dllImport=False)
listenerDict['delegate']['return_class'] = type(method.returnType) is AbsApi.ClassType
listenerDict['delegate']['return'] = "OpaquePointer?" if listenerDict['delegate']['return_class'] else "Void"
listenerDict['delegate']['params_public'] = ""
listenerDict['delegate']['params_private'] = ""
listenerDict['delegate']['params'] = ""
......
......@@ -132,7 +132,7 @@ public class {{interfaceName}} : LinphoneObjectDelegate
{{#methods}}
{{#delegate}}
{{c_name_setter}}(cPtr, { ({{{params_private}}}) -> Void in
{{c_name_setter}}(cPtr, { ({{{params_private}}}) -> {{return}} in
let sObject = {{interfaceClassName}}.getSobject(cObject: {{first_param}})
let delegate = sObject?.currentCallbacks
{{#classLists}}
......@@ -144,7 +144,7 @@ public class {{interfaceName}} : LinphoneObjectDelegate
{{argName}}cList = UnsafePointer<bctbx_list_t>({{argName}}cList!.pointee.next)
}
{{/classLists}}
delegate?.{{cb_name}}({{{params}}})
{{#return_class}}return {{/return_class}}delegate?.{{cb_name}}({{{params}}}){{#return_class}}?.cPtr{{/return_class}}
})
{{/delegate}}
{{/methods}}
......@@ -157,7 +157,7 @@ public class {{interfaceName}} : LinphoneObjectDelegate
{{#methods}}
{{#delegate}}
func {{cb_name}}({{{params_public}}}){}
func {{cb_name}}({{{params_public}}}){{#return_class}} -> {{type}}? {return nil}{{/return_class}}{{^return_class}} {}{{/return_class}}
{{/delegate}}
{{/methods}}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment