Although technically possible, there is no easy way to do this today.
The best thing you can do now is run the application with C # and then, if you want, transfer control to your Objective-C code. During C # startup, you can register methods that will be called back with Objective-C code using P / Invoke to call something like:
delegate void some_callback_t (int parameter1, int parameter2);
[DllImport ("__Internal")]
void SetCallback (some_callback_t callback);
static void mycallback (int parameter1, int parameter2)
{
}
Then you call:
SetCallback (mycallback);
Note that mycallback must be static (a limitation of static compilation). Then your Objective-C code can consume services, implementing something like:
typedef (*callback_t) (int p1, int p2);
callback_t callback;
void SetCallback (callback_t cb)
{
callback = cb;
}
void InvokeCSharp ()
{
callback (1, 2);
}
source
share