I am writing iOS plugins for Unity. I need to call the function below from Unity. The target function is written in Swift.
How can I convert Swift completion block/closure to C#.
What should I write in place of completionHandler?
#if UNITY_IOS
[DllImport("__Internal")]
private static extern void initializeSDK(string name, string apiKey, completionHandler );
#endif
static func init(name: String?, apiKey: String?, completionHandler: @escaping (Bool) -> Void) {
// do some stuffs..
completionHandler(status) // status is of Bool type.
}
also based on suggestions which i have received, i have updated code:
updated code as below, i am getting compile errors in ios side.

2nd suggestion i have tried for which i am getting crash:
attaching images of code snip for reference.




