Hello,
I have swift dylib that I call from a simple c# program through mono. I need the dylib to stay alive and listen to keyboard, mouse, application events as well as receiving commands to move mouse, etc. Looking online I found some suggestion to keep the process running and while they do keep the process alive I'm unable to receive the events I add monitors for.
NSEvent.addGlobalMonitorForEvents(matching: mEvent.eventMask, handler: globalEventCallBack"
I have tried 'Runloop.main.run', DispatchGroup, Semaphore
, and while I understand why some don't work (they block the main thread and that's where the events are delivered) I don't understand others.
So here I'm in search of suggestions of how to keep my process alive and still get the events.
Thank in advance and I apologize if I made any mistakes in the post, it is my first time in this forum.